diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-02 14:29:28 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-10 18:31:10 -0400 |
commit | 00b3ed1685089ff52169a715de11106ed37df087 (patch) | |
tree | 27fff3d6498ca0f5975f8b0ac1c09beda5f9b1da | |
parent | 66101de10957e07a6fd0365d5af9adf650246d14 (diff) |
Staging: add wlan-ng prism2 usb driver
This adds the wlan-ng prism2 USB driver to the drivers/staging tree.
The code was originally written by the linux-wlan-ng team, patched by
some Novell engineers to properly work on newer kernels, and then hacked
into place in order to get it to build properly in a single subdirectory
within the kernel tree by me.
It supports a wide range of older USB prism2 devices, and contains a
80211 stack to support this single driver.
Cc: Christian Zoz <zoz@suse.de>
Cc: Andreas Gruenbacher <agruen@suse.de>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Cc: John Linville <linville@tuxdriver.com>
Cc: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: linux-wlan-ng <solomon@linux-wlan.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
37 files changed, 36060 insertions, 0 deletions
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index fdbdf84e3077..762b471fdeda 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig | |||
@@ -37,4 +37,6 @@ source "drivers/staging/usbip/Kconfig" | |||
37 | 37 | ||
38 | source "drivers/staging/winbond/Kconfig" | 38 | source "drivers/staging/winbond/Kconfig" |
39 | 39 | ||
40 | source "drivers/staging/wlan-ng/Kconfig" | ||
41 | |||
40 | endif # STAGING | 42 | endif # STAGING |
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile index 9b576c91b15e..574198479d66 100644 --- a/drivers/staging/Makefile +++ b/drivers/staging/Makefile | |||
@@ -7,3 +7,4 @@ obj-$(CONFIG_ME4000) += me4000/ | |||
7 | obj-$(CONFIG_VIDEO_GO7007) += go7007/ | 7 | obj-$(CONFIG_VIDEO_GO7007) += go7007/ |
8 | obj-$(CONFIG_USB_IP_COMMON) += usbip/ | 8 | obj-$(CONFIG_USB_IP_COMMON) += usbip/ |
9 | obj-$(CONFIG_W35UND) += winbond/ | 9 | obj-$(CONFIG_W35UND) += winbond/ |
10 | obj-$(CONFIG_PRISM2_USB) += wlan-ng/ | ||
diff --git a/drivers/staging/wlan-ng/Kconfig b/drivers/staging/wlan-ng/Kconfig new file mode 100644 index 000000000000..10b1f0f634d3 --- /dev/null +++ b/drivers/staging/wlan-ng/Kconfig | |||
@@ -0,0 +1,10 @@ | |||
1 | config PRISM2_USB | ||
2 | tristate "Prism2.5 USB driver" | ||
3 | depends on USB | ||
4 | default n | ||
5 | ---help--- | ||
6 | This is the wlan-ng prism 2.5 USB driver for a wide range of | ||
7 | old USB wireless devices. | ||
8 | |||
9 | To compile this driver as a module, choose M here: the module | ||
10 | will be called prism2_usb. | ||
diff --git a/drivers/staging/wlan-ng/Makefile b/drivers/staging/wlan-ng/Makefile new file mode 100644 index 000000000000..777b5111b3d0 --- /dev/null +++ b/drivers/staging/wlan-ng/Makefile | |||
@@ -0,0 +1,9 @@ | |||
1 | obj-$(CONFIG_PRISM2_USB) += prism2_usb.o | ||
2 | obj-$(CONFIG_PRISM2_USB) += p80211.o | ||
3 | |||
4 | p80211-objs := p80211mod.o \ | ||
5 | p80211conv.o \ | ||
6 | p80211req.o \ | ||
7 | p80211wep.o \ | ||
8 | p80211wext.o \ | ||
9 | p80211netdev.o | ||
diff --git a/drivers/staging/wlan-ng/README b/drivers/staging/wlan-ng/README new file mode 100644 index 000000000000..f50e4eb6c272 --- /dev/null +++ b/drivers/staging/wlan-ng/README | |||
@@ -0,0 +1,8 @@ | |||
1 | TODO: | ||
2 | - checkpatch.pl cleanups | ||
3 | - sparse warnings | ||
4 | - Lindent cleanups | ||
5 | - move to use the in-kernel wireless stack | ||
6 | - possible enable the pcmcia and pci portions of the driver | ||
7 | |||
8 | Please send all patches to Greg Kroah-Hartman <greg@kroah.com> | ||
diff --git a/drivers/staging/wlan-ng/hfa384x.c b/drivers/staging/wlan-ng/hfa384x.c new file mode 100644 index 000000000000..04df3fd9c520 --- /dev/null +++ b/drivers/staging/wlan-ng/hfa384x.c | |||
@@ -0,0 +1,4018 @@ | |||
1 | /* src/prism2/driver/hfa384x.c | ||
2 | * | ||
3 | * Implements the functions of the Intersil hfa384x MAC | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file implements functions that correspond to the prism2/hfa384x | ||
48 | * 802.11 MAC hardware and firmware host interface. | ||
49 | * | ||
50 | * The functions can be considered to represent several levels of | ||
51 | * abstraction. The lowest level functions are simply C-callable wrappers | ||
52 | * around the register accesses. The next higher level represents C-callable | ||
53 | * prism2 API functions that match the Intersil documentation as closely | ||
54 | * as is reasonable. The next higher layer implements common sequences | ||
55 | * of invokations of the API layer (e.g. write to bap, followed by cmd). | ||
56 | * | ||
57 | * Common sequences: | ||
58 | * hfa384x_drvr_xxx Highest level abstractions provided by the | ||
59 | * hfa384x code. They are driver defined wrappers | ||
60 | * for common sequences. These functions generally | ||
61 | * use the services of the lower levels. | ||
62 | * | ||
63 | * hfa384x_drvr_xxxconfig An example of the drvr level abstraction. These | ||
64 | * functions are wrappers for the RID get/set | ||
65 | * sequence. They call copy_[to|from]_bap() and | ||
66 | * cmd_access(). These functions operate on the | ||
67 | * RIDs and buffers without validation. The caller | ||
68 | * is responsible for that. | ||
69 | * | ||
70 | * API wrapper functions: | ||
71 | * hfa384x_cmd_xxx functions that provide access to the f/w commands. | ||
72 | * The function arguments correspond to each command | ||
73 | * argument, even command arguments that get packed | ||
74 | * into single registers. These functions _just_ | ||
75 | * issue the command by setting the cmd/parm regs | ||
76 | * & reading the status/resp regs. Additional | ||
77 | * activities required to fully use a command | ||
78 | * (read/write from/to bap, get/set int status etc.) | ||
79 | * are implemented separately. Think of these as | ||
80 | * C-callable prism2 commands. | ||
81 | * | ||
82 | * Lowest Layer Functions: | ||
83 | * hfa384x_docmd_xxx These functions implement the sequence required | ||
84 | * to issue any prism2 command. Primarily used by the | ||
85 | * hfa384x_cmd_xxx functions. | ||
86 | * | ||
87 | * hfa384x_bap_xxx BAP read/write access functions. | ||
88 | * Note: we usually use BAP0 for non-interrupt context | ||
89 | * and BAP1 for interrupt context. | ||
90 | * | ||
91 | * hfa384x_dl_xxx download related functions. | ||
92 | * | ||
93 | * Driver State Issues: | ||
94 | * Note that there are two pairs of functions that manage the | ||
95 | * 'initialized' and 'running' states of the hw/MAC combo. The four | ||
96 | * functions are create(), destroy(), start(), and stop(). create() | ||
97 | * sets up the data structures required to support the hfa384x_* | ||
98 | * functions and destroy() cleans them up. The start() function gets | ||
99 | * the actual hardware running and enables the interrupts. The stop() | ||
100 | * function shuts the hardware down. The sequence should be: | ||
101 | * create() | ||
102 | * . | ||
103 | * . Self contained test routines can run here, particularly | ||
104 | * . corereset() and test_hostif(). | ||
105 | * . | ||
106 | * start() | ||
107 | * . | ||
108 | * . Do interesting things w/ the hardware | ||
109 | * . | ||
110 | * stop() | ||
111 | * destroy() | ||
112 | * | ||
113 | * Note that destroy() can be called without calling stop() first. | ||
114 | * -------------------------------------------------------------------- | ||
115 | */ | ||
116 | |||
117 | /*================================================================*/ | ||
118 | |||
119 | /* System Includes */ | ||
120 | #define WLAN_DBVAR prism2_debug | ||
121 | #include "version.h" | ||
122 | |||
123 | |||
124 | #include <linux/version.h> | ||
125 | |||
126 | #include <linux/module.h> | ||
127 | #include <linux/kernel.h> | ||
128 | #include <linux/sched.h> | ||
129 | #include <linux/types.h> | ||
130 | #include <linux/slab.h> | ||
131 | #include <linux/wireless.h> | ||
132 | #include <linux/netdevice.h> | ||
133 | #include <linux/timer.h> | ||
134 | #include <asm/semaphore.h> | ||
135 | #include <asm/io.h> | ||
136 | #include <linux/delay.h> | ||
137 | #include <asm/byteorder.h> | ||
138 | #include <linux/list.h> | ||
139 | |||
140 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
141 | #include <linux/tqueue.h> | ||
142 | #else | ||
143 | #include <linux/workqueue.h> | ||
144 | #endif | ||
145 | |||
146 | #if (WLAN_HOSTIF == WLAN_PCMCIA) | ||
147 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) ) | ||
148 | #include <pcmcia/version.h> | ||
149 | #endif | ||
150 | #include <pcmcia/cs_types.h> | ||
151 | #include <pcmcia/cs.h> | ||
152 | #include <pcmcia/cistpl.h> | ||
153 | #include <pcmcia/ds.h> | ||
154 | #include <pcmcia/cisreg.h> | ||
155 | #endif | ||
156 | |||
157 | #if ((WLAN_HOSTIF == WLAN_PLX) || (WLAN_HOSTIF == WLAN_PCI)) | ||
158 | #include <linux/ioport.h> | ||
159 | #include <linux/pci.h> | ||
160 | #endif | ||
161 | |||
162 | #include "wlan_compat.h" | ||
163 | |||
164 | // XXXX #define CMD_IRQ | ||
165 | |||
166 | /*================================================================*/ | ||
167 | /* Project Includes */ | ||
168 | |||
169 | #include "p80211types.h" | ||
170 | #include "p80211hdr.h" | ||
171 | #include "p80211mgmt.h" | ||
172 | #include "p80211conv.h" | ||
173 | #include "p80211msg.h" | ||
174 | #include "p80211netdev.h" | ||
175 | #include "p80211req.h" | ||
176 | #include "p80211metadef.h" | ||
177 | #include "p80211metastruct.h" | ||
178 | #include "hfa384x.h" | ||
179 | #include "prism2mgmt.h" | ||
180 | |||
181 | /*================================================================*/ | ||
182 | /* Local Constants */ | ||
183 | |||
184 | static const UINT16 crc16tab[256] = | ||
185 | { | ||
186 | 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, | ||
187 | 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, | ||
188 | 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, | ||
189 | 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, | ||
190 | 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, | ||
191 | 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, | ||
192 | 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, | ||
193 | 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, | ||
194 | 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, | ||
195 | 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, | ||
196 | 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, | ||
197 | 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, | ||
198 | 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, | ||
199 | 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, | ||
200 | 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, | ||
201 | 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, | ||
202 | 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, | ||
203 | 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, | ||
204 | 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, | ||
205 | 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, | ||
206 | 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, | ||
207 | 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, | ||
208 | 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, | ||
209 | 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, | ||
210 | 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, | ||
211 | 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, | ||
212 | 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, | ||
213 | 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, | ||
214 | 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, | ||
215 | 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, | ||
216 | 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, | ||
217 | 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 | ||
218 | }; | ||
219 | |||
220 | /*================================================================*/ | ||
221 | /* Local Macros */ | ||
222 | |||
223 | /*================================================================*/ | ||
224 | /* Local Types */ | ||
225 | |||
226 | /*================================================================*/ | ||
227 | /* Local Static Definitions */ | ||
228 | extern int prism2_debug; | ||
229 | |||
230 | /*================================================================*/ | ||
231 | /* Local Function Declarations */ | ||
232 | |||
233 | static void hfa384x_int_dtim(wlandevice_t *wlandev); | ||
234 | static void hfa384x_int_infdrop(wlandevice_t *wlandev); | ||
235 | |||
236 | static void hfa384x_bap_tasklet(unsigned long data); | ||
237 | |||
238 | static void hfa384x_int_info(wlandevice_t *wlandev); | ||
239 | static void hfa384x_int_txexc(wlandevice_t *wlandev); | ||
240 | static void hfa384x_int_tx(wlandevice_t *wlandev); | ||
241 | static void hfa384x_int_rx(wlandevice_t *wlandev); | ||
242 | |||
243 | #ifdef CMD_IRQ | ||
244 | static void hfa384x_int_cmd(wlandevice_t *wlandev); | ||
245 | #endif | ||
246 | static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, | ||
247 | UINT16 rxfid, hfa384x_rx_frame_t *rxdesc); | ||
248 | static void hfa384x_int_alloc(wlandevice_t *wlandev); | ||
249 | |||
250 | static int hfa384x_docmd_wait( hfa384x_t *hw, hfa384x_metacmd_t *cmd); | ||
251 | |||
252 | static int hfa384x_dl_docmd_wait( hfa384x_t *hw, hfa384x_metacmd_t *cmd); | ||
253 | |||
254 | static UINT16 | ||
255 | hfa384x_mkcrc16(UINT8 *p, int len); | ||
256 | |||
257 | int hfa384x_copy_to_bap4(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset, | ||
258 | void *buf, UINT len, void* buf2, UINT len2, | ||
259 | void *buf3, UINT len3, void* buf4, UINT len4); | ||
260 | |||
261 | /*================================================================*/ | ||
262 | /* Function Definitions */ | ||
263 | |||
264 | static UINT16 | ||
265 | txfid_queue_empty(hfa384x_t *hw) | ||
266 | { | ||
267 | return (hw->txfid_head == hw->txfid_tail) ? 1 : 0; | ||
268 | } | ||
269 | |||
270 | static UINT16 | ||
271 | txfid_queue_remove(hfa384x_t *hw) | ||
272 | { | ||
273 | UINT16 result= 0; | ||
274 | |||
275 | if (txfid_queue_empty(hw)) { | ||
276 | WLAN_LOG_DEBUG(3,"queue empty.\n"); | ||
277 | } else { | ||
278 | result = hw->txfid_queue[hw->txfid_head]; | ||
279 | hw->txfid_head = (hw->txfid_head + 1) % hw->txfid_N; | ||
280 | } | ||
281 | |||
282 | return (UINT16)result; | ||
283 | } | ||
284 | |||
285 | static INT16 | ||
286 | txfid_queue_add(hfa384x_t *hw, UINT16 val) | ||
287 | { | ||
288 | INT16 result = 0; | ||
289 | |||
290 | if (hw->txfid_head == ((hw->txfid_tail + 1) % hw->txfid_N)) { | ||
291 | result = -1; | ||
292 | WLAN_LOG_DEBUG(3,"queue full.\n"); | ||
293 | } else { | ||
294 | hw->txfid_queue[hw->txfid_tail] = val; | ||
295 | result = hw->txfid_tail; | ||
296 | hw->txfid_tail = (hw->txfid_tail + 1) % hw->txfid_N; | ||
297 | } | ||
298 | |||
299 | return result; | ||
300 | } | ||
301 | |||
302 | /*---------------------------------------------------------------- | ||
303 | * hfa384x_create | ||
304 | * | ||
305 | * Initializes the hfa384x_t data structure for use. Note this | ||
306 | * does _not_ intialize the actual hardware, just the data structures | ||
307 | * we use to keep track of its state. | ||
308 | * | ||
309 | * Arguments: | ||
310 | * hw device structure | ||
311 | * irq device irq number | ||
312 | * iobase [pcmcia] i/o base address for register access | ||
313 | * [pci] zero | ||
314 | * [plx] i/o base address for register access | ||
315 | * membase [pcmcia] pcmcia_cs "link" pointer | ||
316 | * [pci] memory base address for register access | ||
317 | * [plx] memory base address for card attribute memory | ||
318 | * | ||
319 | * Returns: | ||
320 | * nothing | ||
321 | * | ||
322 | * Side effects: | ||
323 | * | ||
324 | * Call context: | ||
325 | * process thread | ||
326 | ----------------------------------------------------------------*/ | ||
327 | void hfa384x_create(hfa384x_t *hw, UINT irq, UINT32 iobase, | ||
328 | UINT8 __iomem *membase) | ||
329 | { | ||
330 | DBFENTER; | ||
331 | memset(hw, 0, sizeof(hfa384x_t)); | ||
332 | hw->irq = irq; | ||
333 | hw->iobase = iobase; | ||
334 | hw->membase = membase; | ||
335 | spin_lock_init(&(hw->cmdlock)); | ||
336 | |||
337 | /* BAP setup */ | ||
338 | spin_lock_init(&(hw->baplock)); | ||
339 | tasklet_init(&hw->bap_tasklet, | ||
340 | hfa384x_bap_tasklet, | ||
341 | (unsigned long) hw); | ||
342 | |||
343 | init_waitqueue_head(&hw->cmdq); | ||
344 | sema_init(&hw->infofid_sem, 1); | ||
345 | |||
346 | hw->txfid_head = 0; | ||
347 | hw->txfid_tail = 0; | ||
348 | hw->txfid_N = HFA384x_DRVR_FIDSTACKLEN_MAX; | ||
349 | memset(hw->txfid_queue, 0, sizeof(hw->txfid_queue)); | ||
350 | |||
351 | hw->isram16 = 1; | ||
352 | |||
353 | /* Init the auth queue head */ | ||
354 | skb_queue_head_init(&hw->authq); | ||
355 | |||
356 | INIT_WORK2(&hw->link_bh, prism2sta_processing_defer); | ||
357 | |||
358 | INIT_WORK2(&hw->commsqual_bh, prism2sta_commsqual_defer); | ||
359 | |||
360 | init_timer(&hw->commsqual_timer); | ||
361 | hw->commsqual_timer.data = (unsigned long) hw; | ||
362 | hw->commsqual_timer.function = prism2sta_commsqual_timer; | ||
363 | |||
364 | hw->link_status = HFA384x_LINK_NOTCONNECTED; | ||
365 | hw->state = HFA384x_STATE_INIT; | ||
366 | |||
367 | DBFEXIT; | ||
368 | } | ||
369 | |||
370 | /*---------------------------------------------------------------- | ||
371 | * hfa384x_destroy | ||
372 | * | ||
373 | * Partner to hfa384x_create(). This function cleans up the hw | ||
374 | * structure so that it can be freed by the caller using a simple | ||
375 | * kfree. Currently, this function is just a placeholder. If, at some | ||
376 | * point in the future, an hw in the 'shutdown' state requires a 'deep' | ||
377 | * kfree, this is where it should be done. Note that if this function | ||
378 | * is called on a _running_ hw structure, the drvr_stop() function is | ||
379 | * called. | ||
380 | * | ||
381 | * Arguments: | ||
382 | * hw device structure | ||
383 | * | ||
384 | * Returns: | ||
385 | * nothing, this function is not allowed to fail. | ||
386 | * | ||
387 | * Side effects: | ||
388 | * | ||
389 | * Call context: | ||
390 | * process | ||
391 | ----------------------------------------------------------------*/ | ||
392 | void | ||
393 | hfa384x_destroy( hfa384x_t *hw) | ||
394 | { | ||
395 | struct sk_buff *skb; | ||
396 | |||
397 | DBFENTER; | ||
398 | |||
399 | if ( hw->state == HFA384x_STATE_RUNNING ) { | ||
400 | hfa384x_drvr_stop(hw); | ||
401 | } | ||
402 | hw->state = HFA384x_STATE_PREINIT; | ||
403 | |||
404 | if (hw->scanresults) { | ||
405 | kfree(hw->scanresults); | ||
406 | hw->scanresults = NULL; | ||
407 | } | ||
408 | |||
409 | /* Now to clean out the auth queue */ | ||
410 | while ( (skb = skb_dequeue(&hw->authq)) ) { | ||
411 | dev_kfree_skb(skb); | ||
412 | } | ||
413 | |||
414 | DBFEXIT; | ||
415 | return; | ||
416 | } | ||
417 | |||
418 | /*---------------------------------------------------------------- | ||
419 | * hfa384x_drvr_getconfig | ||
420 | * | ||
421 | * Performs the sequence necessary to read a config/info item. | ||
422 | * | ||
423 | * Arguments: | ||
424 | * hw device structure | ||
425 | * rid config/info record id (host order) | ||
426 | * buf host side record buffer. Upon return it will | ||
427 | * contain the body portion of the record (minus the | ||
428 | * RID and len). | ||
429 | * len buffer length (in bytes, should match record length) | ||
430 | * | ||
431 | * Returns: | ||
432 | * 0 success | ||
433 | * >0 f/w reported error - f/w status code | ||
434 | * <0 driver reported error | ||
435 | * -ENODATA length mismatch between argument and retrieved | ||
436 | * record. | ||
437 | * | ||
438 | * Side effects: | ||
439 | * | ||
440 | * Call context: | ||
441 | * process thread | ||
442 | ----------------------------------------------------------------*/ | ||
443 | int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) | ||
444 | { | ||
445 | int result = 0; | ||
446 | DBFENTER; | ||
447 | |||
448 | result = hfa384x_cmd_access( hw, 0, rid, buf, len); | ||
449 | |||
450 | DBFEXIT; | ||
451 | return result; | ||
452 | } | ||
453 | |||
454 | |||
455 | /*---------------------------------------------------------------- | ||
456 | * hfa384x_drvr_setconfig | ||
457 | * | ||
458 | * Performs the sequence necessary to write a config/info item. | ||
459 | * | ||
460 | * Arguments: | ||
461 | * hw device structure | ||
462 | * rid config/info record id (in host order) | ||
463 | * buf host side record buffer | ||
464 | * len buffer length (in bytes) | ||
465 | * | ||
466 | * Returns: | ||
467 | * 0 success | ||
468 | * >0 f/w reported error - f/w status code | ||
469 | * <0 driver reported error | ||
470 | * | ||
471 | * Side effects: | ||
472 | * | ||
473 | * Call context: | ||
474 | * process thread | ||
475 | ----------------------------------------------------------------*/ | ||
476 | int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) | ||
477 | { | ||
478 | int result = 0; | ||
479 | DBFENTER; | ||
480 | |||
481 | result = hfa384x_cmd_access( hw, 1, rid, buf, len); | ||
482 | |||
483 | DBFEXIT; | ||
484 | return result; | ||
485 | } | ||
486 | |||
487 | |||
488 | /*---------------------------------------------------------------- | ||
489 | * hfa384x_drvr_readpda | ||
490 | * | ||
491 | * Performs the sequence to read the PDA space. Note there is no | ||
492 | * drvr_writepda() function. Writing a PDA is | ||
493 | * generally implemented by a calling component via calls to | ||
494 | * cmd_download and writing to the flash download buffer via the | ||
495 | * aux regs. | ||
496 | * | ||
497 | * Arguments: | ||
498 | * hw device structure | ||
499 | * buf buffer to store PDA in | ||
500 | * len buffer length | ||
501 | * | ||
502 | * Returns: | ||
503 | * 0 success | ||
504 | * >0 f/w reported error - f/w status code | ||
505 | * <0 driver reported error | ||
506 | * -ETIMEOUT timout waiting for the cmd regs to become | ||
507 | * available, or waiting for the control reg | ||
508 | * to indicate the Aux port is enabled. | ||
509 | * -ENODATA the buffer does NOT contain a valid PDA. | ||
510 | * Either the card PDA is bad, or the auxdata | ||
511 | * reads are giving us garbage. | ||
512 | |||
513 | * | ||
514 | * Side effects: | ||
515 | * | ||
516 | * Call context: | ||
517 | * process thread or non-card interrupt. | ||
518 | ----------------------------------------------------------------*/ | ||
519 | int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len) | ||
520 | { | ||
521 | int result = 0; | ||
522 | UINT16 *pda = buf; | ||
523 | int pdaok = 0; | ||
524 | int morepdrs = 1; | ||
525 | int currpdr = 0; /* word offset of the current pdr */ | ||
526 | int i; | ||
527 | UINT16 pdrlen; /* pdr length in bytes, host order */ | ||
528 | UINT16 pdrcode; /* pdr code, host order */ | ||
529 | UINT16 crc; | ||
530 | UINT16 pdacrc; | ||
531 | struct pdaloc { | ||
532 | UINT32 cardaddr; | ||
533 | UINT16 auxctl; | ||
534 | } pdaloc[] = | ||
535 | { | ||
536 | { HFA3842_PDA_BASE, HFA384x_AUX_CTL_NV}, | ||
537 | { HFA3842_PDA_BASE, HFA384x_AUX_CTL_EXTDS}, | ||
538 | { HFA3841_PDA_BASE, HFA384x_AUX_CTL_NV}, | ||
539 | { HFA3841_PDA_BASE, HFA384x_AUX_CTL_EXTDS}, | ||
540 | { HFA3841_PDA_BOGUS_BASE, HFA384x_AUX_CTL_NV} | ||
541 | }; | ||
542 | |||
543 | DBFENTER; | ||
544 | /* Check for aux available */ | ||
545 | result = hfa384x_cmd_aux_enable(hw, 0); | ||
546 | if ( result ) { | ||
547 | WLAN_LOG_DEBUG(1,"aux_enable() failed. result=%d\n", result); | ||
548 | goto failed; | ||
549 | } | ||
550 | |||
551 | /* Read the pda from each known address. */ | ||
552 | for ( i = 0; i < (sizeof(pdaloc)/sizeof(pdaloc[0])); i++) { | ||
553 | WLAN_LOG_DEBUG( 3, "Checking PDA@(0x%08x,%s)\n", | ||
554 | pdaloc[i].cardaddr, | ||
555 | pdaloc[i].auxctl == HFA384x_AUX_CTL_NV ? | ||
556 | "CTL_NV" : "CTL_EXTDS"); | ||
557 | |||
558 | /* Copy bufsize bytes from our current pdaloc */ | ||
559 | hfa384x_copy_from_aux(hw, | ||
560 | pdaloc[i].cardaddr, | ||
561 | pdaloc[i].auxctl, | ||
562 | buf, | ||
563 | len); | ||
564 | |||
565 | /* Test for garbage */ | ||
566 | /* Traverse the PDR list Looking for PDA-END */ | ||
567 | pdaok = 1; /* intially assume good */ | ||
568 | morepdrs = 1; | ||
569 | currpdr = 0; | ||
570 | while ( pdaok && morepdrs ) { | ||
571 | pdrlen = hfa384x2host_16(pda[currpdr]) * 2; | ||
572 | pdrcode = hfa384x2host_16(pda[currpdr+1]); | ||
573 | |||
574 | /* Test for completion at END record */ | ||
575 | if ( pdrcode == HFA384x_PDR_END_OF_PDA ) { | ||
576 | if ( pdrlen == 4 ) { | ||
577 | morepdrs = 0; | ||
578 | /* Calculate CRC-16 and compare to PDA | ||
579 | * value. Note the addition of 2 words | ||
580 | * for ENDREC.len and ENDREC.code | ||
581 | * fields. | ||
582 | */ | ||
583 | crc = hfa384x_mkcrc16( (UINT8*)pda, | ||
584 | (currpdr + 2) * sizeof(UINT16)); | ||
585 | pdacrc =hfa384x2host_16(pda[currpdr+2]); | ||
586 | if ( crc != pdacrc ) { | ||
587 | WLAN_LOG_DEBUG(3, | ||
588 | "PDA crc failed:" | ||
589 | "calc_crc=0x%04x," | ||
590 | "pdr_crc=0x%04x.\n", | ||
591 | crc, pdacrc); | ||
592 | pdaok = 0; | ||
593 | } | ||
594 | } else { | ||
595 | WLAN_LOG_DEBUG(3, | ||
596 | "END record detected w/ " | ||
597 | "len(%d) != 2, assuming bad PDA\n", | ||
598 | pdrlen); | ||
599 | pdaok = 0; | ||
600 | |||
601 | } | ||
602 | break; | ||
603 | } | ||
604 | |||
605 | /* Test the record length */ | ||
606 | if ( pdrlen > HFA384x_PDR_LEN_MAX || pdrlen == 0) { | ||
607 | WLAN_LOG_DEBUG(3, | ||
608 | "pdrlen for address #%d " | ||
609 | "at %#x:%#x:%d\n", | ||
610 | i, pdaloc[i].cardaddr, | ||
611 | pdaloc[i].auxctl, pdrlen); | ||
612 | WLAN_LOG_DEBUG(3,"pdrlen invalid=%d\n", | ||
613 | pdrlen); | ||
614 | pdaok = 0; | ||
615 | break; | ||
616 | } | ||
617 | |||
618 | /* Move to the next pdr */ | ||
619 | if ( morepdrs ) { | ||
620 | /* note the access to pda[], we need words */ | ||
621 | currpdr += hfa384x2host_16(pda[currpdr]) + 1; | ||
622 | if (currpdr*sizeof(UINT16) > len) { | ||
623 | WLAN_LOG_DEBUG(3, | ||
624 | "Didn't find PDA_END in buffer, " | ||
625 | "trying next location.\n"); | ||
626 | pdaok = 0; | ||
627 | break; | ||
628 | } | ||
629 | } | ||
630 | } | ||
631 | if ( pdaok ) { | ||
632 | WLAN_LOG_INFO( | ||
633 | "PDA Read from 0x%08x in %s space.\n", | ||
634 | pdaloc[i].cardaddr, | ||
635 | pdaloc[i].auxctl == 0 ? "EXTDS" : | ||
636 | pdaloc[i].auxctl == 1 ? "NV" : | ||
637 | pdaloc[i].auxctl == 2 ? "PHY" : | ||
638 | pdaloc[i].auxctl == 3 ? "ICSRAM" : | ||
639 | "<bogus auxctl>"); | ||
640 | break; | ||
641 | } | ||
642 | } | ||
643 | result = pdaok ? 0 : -ENODATA; | ||
644 | |||
645 | if ( result ) { | ||
646 | WLAN_LOG_DEBUG(3,"Failure: pda is not okay\n"); | ||
647 | } | ||
648 | |||
649 | hfa384x_cmd_aux_disable(hw); | ||
650 | failed: | ||
651 | DBFEXIT; | ||
652 | return result; | ||
653 | } | ||
654 | |||
655 | |||
656 | |||
657 | /*---------------------------------------------------------------- | ||
658 | * mkpda_crc | ||
659 | * | ||
660 | * Calculates the CRC16 for the given PDA and inserts the value | ||
661 | * into the end record. | ||
662 | * | ||
663 | * Arguments: | ||
664 | * pda ptr to the PDA data structure. | ||
665 | * | ||
666 | * Returns: | ||
667 | * 0 - success | ||
668 | * ~0 - failure (probably an errno) | ||
669 | ----------------------------------------------------------------*/ | ||
670 | static UINT16 | ||
671 | hfa384x_mkcrc16(UINT8 *p, int len) | ||
672 | { | ||
673 | UINT16 crc = 0; | ||
674 | UINT8 *lim = p + len; | ||
675 | |||
676 | while (p < lim) { | ||
677 | crc = (crc >> 8 ) ^ crc16tab[(crc & 0xff) ^ *p++]; | ||
678 | } | ||
679 | |||
680 | return crc; | ||
681 | } | ||
682 | |||
683 | |||
684 | /*---------------------------------------------------------------- | ||
685 | * hfa384x_drvr_ramdl_enable | ||
686 | * | ||
687 | * Begins the ram download state. Checks to see that we're not | ||
688 | * already in a download state and that a port isn't enabled. | ||
689 | * Sets the download state and calls cmd_download with the | ||
690 | * ENABLE_VOLATILE subcommand and the exeaddr argument. | ||
691 | * | ||
692 | * Arguments: | ||
693 | * hw device structure | ||
694 | * exeaddr the card execution address that will be | ||
695 | * jumped to when ramdl_disable() is called | ||
696 | * (host order). | ||
697 | * | ||
698 | * Returns: | ||
699 | * 0 success | ||
700 | * >0 f/w reported error - f/w status code | ||
701 | * <0 driver reported error | ||
702 | * | ||
703 | * Side effects: | ||
704 | * | ||
705 | * Call context: | ||
706 | * process thread | ||
707 | ----------------------------------------------------------------*/ | ||
708 | int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr) | ||
709 | { | ||
710 | int result = 0; | ||
711 | UINT16 lowaddr; | ||
712 | UINT16 hiaddr; | ||
713 | int i; | ||
714 | DBFENTER; | ||
715 | /* Check that a port isn't active */ | ||
716 | for ( i = 0; i < HFA384x_PORTID_MAX; i++) { | ||
717 | if ( hw->port_enabled[i] ) { | ||
718 | WLAN_LOG_DEBUG(1,"Can't download with a port enabled.\n"); | ||
719 | result = -EINVAL; | ||
720 | goto done; | ||
721 | } | ||
722 | } | ||
723 | |||
724 | /* Check that we're not already in a download state */ | ||
725 | if ( hw->dlstate != HFA384x_DLSTATE_DISABLED ) { | ||
726 | WLAN_LOG_DEBUG(1,"Download state not disabled.\n"); | ||
727 | result = -EINVAL; | ||
728 | goto done; | ||
729 | } | ||
730 | |||
731 | /* Are we supposed to go into genesis mode? */ | ||
732 | if (exeaddr == 0x3f0000) { | ||
733 | UINT16 initseq[2] = { 0xe100, 0xffa1 }; | ||
734 | UINT16 readbuf[2]; | ||
735 | UINT8 hcr = 0x0f; /* Default to x16 SRAM */ | ||
736 | hw->isram16 = 1; | ||
737 | |||
738 | WLAN_LOG_DEBUG(1, "Dropping into Genesis mode\n"); | ||
739 | |||
740 | /* Issue card reset and enable aux port */ | ||
741 | hfa384x_corereset(hw, prism2_reset_holdtime, | ||
742 | prism2_reset_settletime, 0); | ||
743 | hfa384x_cmd_aux_enable(hw, 1); | ||
744 | |||
745 | /* Genesis set */ | ||
746 | hfa384x_copy_to_aux(hw, 0x7E0038, HFA384x_AUX_CTL_EXTDS, | ||
747 | initseq, sizeof(initseq)); | ||
748 | |||
749 | hfa384x_corereset(hw, prism2_reset_holdtime, | ||
750 | prism2_reset_settletime, hcr); | ||
751 | |||
752 | /* Validate memory config */ | ||
753 | hfa384x_copy_to_aux(hw, 0x7E0038, HFA384x_AUX_CTL_EXTDS, | ||
754 | initseq, sizeof(initseq)); | ||
755 | hfa384x_copy_from_aux(hw, 0x7E0038, HFA384x_AUX_CTL_EXTDS, | ||
756 | readbuf, sizeof(initseq)); | ||
757 | WLAN_HEX_DUMP(3, "readback", readbuf, sizeof(readbuf)); | ||
758 | |||
759 | if (memcmp(initseq, readbuf, sizeof(readbuf))) { | ||
760 | hcr = 0x1f; /* x8 SRAM */ | ||
761 | hw->isram16 = 0; | ||
762 | |||
763 | hfa384x_copy_to_aux(hw, 0x7E0038, HFA384x_AUX_CTL_EXTDS, | ||
764 | initseq, sizeof(initseq)); | ||
765 | hfa384x_corereset(hw, prism2_reset_holdtime, | ||
766 | prism2_reset_settletime, hcr); | ||
767 | |||
768 | hfa384x_copy_to_aux(hw, 0x7E0038, HFA384x_AUX_CTL_EXTDS, | ||
769 | initseq, sizeof(initseq)); | ||
770 | hfa384x_copy_from_aux(hw, 0x7E0038, HFA384x_AUX_CTL_EXTDS, | ||
771 | readbuf, sizeof(initseq)); | ||
772 | WLAN_HEX_DUMP(2, "readback", readbuf, sizeof(readbuf)); | ||
773 | |||
774 | if (memcmp(initseq, readbuf, sizeof(readbuf))) { | ||
775 | WLAN_LOG_ERROR("Genesis mode failed\n"); | ||
776 | result = -1; | ||
777 | goto done; | ||
778 | } | ||
779 | } | ||
780 | |||
781 | /* Now we're in genesis mode */ | ||
782 | hw->dlstate = HFA384x_DLSTATE_GENESIS; | ||
783 | goto done; | ||
784 | } | ||
785 | |||
786 | /* Retrieve the buffer loc&size and timeout */ | ||
787 | if ( (result = hfa384x_drvr_getconfig(hw, HFA384x_RID_DOWNLOADBUFFER, | ||
788 | &(hw->bufinfo), sizeof(hw->bufinfo))) ) { | ||
789 | goto done; | ||
790 | } | ||
791 | hw->bufinfo.page = hfa384x2host_16(hw->bufinfo.page); | ||
792 | hw->bufinfo.offset = hfa384x2host_16(hw->bufinfo.offset); | ||
793 | hw->bufinfo.len = hfa384x2host_16(hw->bufinfo.len); | ||
794 | if ( (result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_MAXLOADTIME, | ||
795 | &(hw->dltimeout))) ) { | ||
796 | goto done; | ||
797 | } | ||
798 | hw->dltimeout = hfa384x2host_16(hw->dltimeout); | ||
799 | |||
800 | /* Enable the aux port */ | ||
801 | if ( (result = hfa384x_cmd_aux_enable(hw, 0)) ) { | ||
802 | WLAN_LOG_DEBUG(1,"Aux enable failed, result=%d.\n", result); | ||
803 | goto done; | ||
804 | } | ||
805 | |||
806 | /* Call the download(1,addr) function */ | ||
807 | lowaddr = HFA384x_ADDR_CMD_MKOFF(exeaddr); | ||
808 | hiaddr = HFA384x_ADDR_CMD_MKPAGE(exeaddr); | ||
809 | |||
810 | result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_RAM, | ||
811 | lowaddr, hiaddr, 0); | ||
812 | if ( result == 0) { | ||
813 | /* Set the download state */ | ||
814 | hw->dlstate = HFA384x_DLSTATE_RAMENABLED; | ||
815 | } else { | ||
816 | WLAN_LOG_DEBUG(1,"cmd_download(0x%04x, 0x%04x) failed, result=%d.\n", | ||
817 | lowaddr,hiaddr, result); | ||
818 | /* Disable the aux port */ | ||
819 | hfa384x_cmd_aux_disable(hw); | ||
820 | } | ||
821 | |||
822 | done: | ||
823 | DBFEXIT; | ||
824 | return result; | ||
825 | } | ||
826 | |||
827 | |||
828 | /*---------------------------------------------------------------- | ||
829 | * hfa384x_drvr_ramdl_disable | ||
830 | * | ||
831 | * Ends the ram download state. | ||
832 | * | ||
833 | * Arguments: | ||
834 | * hw device structure | ||
835 | * | ||
836 | * Returns: | ||
837 | * 0 success | ||
838 | * >0 f/w reported error - f/w status code | ||
839 | * <0 driver reported error | ||
840 | * | ||
841 | * Side effects: | ||
842 | * | ||
843 | * Call context: | ||
844 | * process thread | ||
845 | ----------------------------------------------------------------*/ | ||
846 | int hfa384x_drvr_ramdl_disable(hfa384x_t *hw) | ||
847 | { | ||
848 | DBFENTER; | ||
849 | /* Check that we're already in the download state */ | ||
850 | if ( ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) && | ||
851 | ( hw->dlstate != HFA384x_DLSTATE_GENESIS ) ) { | ||
852 | return -EINVAL; | ||
853 | } | ||
854 | |||
855 | if (hw->dlstate == HFA384x_DLSTATE_GENESIS) { | ||
856 | hfa384x_corereset(hw, prism2_reset_holdtime, | ||
857 | prism2_reset_settletime, | ||
858 | hw->isram16 ? 0x07: 0x17); | ||
859 | goto done; | ||
860 | } | ||
861 | |||
862 | /* Disable the aux port */ | ||
863 | hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0); | ||
864 | |||
865 | done: | ||
866 | hw->dlstate = HFA384x_DLSTATE_DISABLED; | ||
867 | hfa384x_cmd_aux_disable(hw); | ||
868 | |||
869 | DBFEXIT; | ||
870 | return 0; | ||
871 | } | ||
872 | |||
873 | |||
874 | /*---------------------------------------------------------------- | ||
875 | * hfa384x_drvr_ramdl_write | ||
876 | * | ||
877 | * Performs a RAM download of a chunk of data. First checks to see | ||
878 | * that we're in the RAM download state, then uses the aux functions | ||
879 | * to 1) copy the data, 2) readback and compare. The download | ||
880 | * state is unaffected. When all data has been written using | ||
881 | * this function, call drvr_ramdl_disable() to end the download state | ||
882 | * and restart the MAC. | ||
883 | * | ||
884 | * Arguments: | ||
885 | * hw device structure | ||
886 | * daddr Card address to write to. (host order) | ||
887 | * buf Ptr to data to write. | ||
888 | * len Length of data (host order). | ||
889 | * | ||
890 | * Returns: | ||
891 | * 0 success | ||
892 | * >0 f/w reported error - f/w status code | ||
893 | * <0 driver reported error | ||
894 | * | ||
895 | * Side effects: | ||
896 | * | ||
897 | * Call context: | ||
898 | * process thread | ||
899 | ----------------------------------------------------------------*/ | ||
900 | int hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len) | ||
901 | { | ||
902 | int result = 0; | ||
903 | UINT8 *verbuf; | ||
904 | DBFENTER; | ||
905 | /* Check that we're in the ram download state */ | ||
906 | if ( ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) && | ||
907 | ( hw->dlstate != HFA384x_DLSTATE_GENESIS ) ) { | ||
908 | return -EINVAL; | ||
909 | } | ||
910 | |||
911 | WLAN_LOG_INFO("Writing %d bytes to ram @0x%06x\n", len, daddr); | ||
912 | #if 0 | ||
913 | WLAN_HEX_DUMP(1, "dldata", buf, len); | ||
914 | #endif | ||
915 | /* Copy the data via the aux port */ | ||
916 | hfa384x_copy_to_aux(hw, daddr, HFA384x_AUX_CTL_EXTDS, buf, len); | ||
917 | |||
918 | /* Create a buffer for the verify */ | ||
919 | verbuf = kmalloc(len, GFP_KERNEL); | ||
920 | if (verbuf == NULL ) return 1; | ||
921 | |||
922 | /* Read back and compare */ | ||
923 | hfa384x_copy_from_aux(hw, daddr, HFA384x_AUX_CTL_EXTDS, verbuf, len); | ||
924 | |||
925 | if ( memcmp(buf, verbuf, len) ) { | ||
926 | WLAN_LOG_DEBUG(1,"ramdl verify failed!\n"); | ||
927 | result = -EINVAL; | ||
928 | } | ||
929 | |||
930 | kfree_s(verbuf, len); | ||
931 | DBFEXIT; | ||
932 | return result; | ||
933 | } | ||
934 | |||
935 | |||
936 | /*---------------------------------------------------------------- | ||
937 | * hfa384x_drvr_flashdl_enable | ||
938 | * | ||
939 | * Begins the flash download state. Checks to see that we're not | ||
940 | * already in a download state and that a port isn't enabled. | ||
941 | * Sets the download state and retrieves the flash download | ||
942 | * buffer location, buffer size, and timeout length. | ||
943 | * | ||
944 | * Arguments: | ||
945 | * hw device structure | ||
946 | * | ||
947 | * Returns: | ||
948 | * 0 success | ||
949 | * >0 f/w reported error - f/w status code | ||
950 | * <0 driver reported error | ||
951 | * | ||
952 | * Side effects: | ||
953 | * | ||
954 | * Call context: | ||
955 | * process thread | ||
956 | ----------------------------------------------------------------*/ | ||
957 | int hfa384x_drvr_flashdl_enable(hfa384x_t *hw) | ||
958 | { | ||
959 | int result = 0; | ||
960 | int i; | ||
961 | |||
962 | DBFENTER; | ||
963 | /* Check that a port isn't active */ | ||
964 | for ( i = 0; i < HFA384x_PORTID_MAX; i++) { | ||
965 | if ( hw->port_enabled[i] ) { | ||
966 | WLAN_LOG_DEBUG(1,"called when port enabled.\n"); | ||
967 | return -EINVAL; | ||
968 | } | ||
969 | } | ||
970 | |||
971 | /* Check that we're not already in a download state */ | ||
972 | if ( hw->dlstate != HFA384x_DLSTATE_DISABLED ) { | ||
973 | return -EINVAL; | ||
974 | } | ||
975 | |||
976 | /* Retrieve the buffer loc&size and timeout */ | ||
977 | if ( (result = hfa384x_drvr_getconfig(hw, HFA384x_RID_DOWNLOADBUFFER, | ||
978 | &(hw->bufinfo), sizeof(hw->bufinfo))) ) { | ||
979 | return result; | ||
980 | } | ||
981 | hw->bufinfo.page = hfa384x2host_16(hw->bufinfo.page); | ||
982 | hw->bufinfo.offset = hfa384x2host_16(hw->bufinfo.offset); | ||
983 | hw->bufinfo.len = hfa384x2host_16(hw->bufinfo.len); | ||
984 | if ( (result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_MAXLOADTIME, | ||
985 | &(hw->dltimeout))) ) { | ||
986 | return result; | ||
987 | } | ||
988 | hw->dltimeout = hfa384x2host_16(hw->dltimeout); | ||
989 | |||
990 | /* Enable the aux port */ | ||
991 | if ( (result = hfa384x_cmd_aux_enable(hw, 0)) ) { | ||
992 | return result; | ||
993 | } | ||
994 | |||
995 | hw->dlstate = HFA384x_DLSTATE_FLASHENABLED; | ||
996 | DBFEXIT; | ||
997 | return result; | ||
998 | } | ||
999 | |||
1000 | |||
1001 | /*---------------------------------------------------------------- | ||
1002 | * hfa384x_drvr_flashdl_disable | ||
1003 | * | ||
1004 | * Ends the flash download state. Note that this will cause the MAC | ||
1005 | * firmware to restart. | ||
1006 | * | ||
1007 | * Arguments: | ||
1008 | * hw device structure | ||
1009 | * | ||
1010 | * Returns: | ||
1011 | * 0 success | ||
1012 | * >0 f/w reported error - f/w status code | ||
1013 | * <0 driver reported error | ||
1014 | * | ||
1015 | * Side effects: | ||
1016 | * | ||
1017 | * Call context: | ||
1018 | * process thread | ||
1019 | ----------------------------------------------------------------*/ | ||
1020 | int hfa384x_drvr_flashdl_disable(hfa384x_t *hw) | ||
1021 | { | ||
1022 | DBFENTER; | ||
1023 | /* Check that we're already in the download state */ | ||
1024 | if ( hw->dlstate != HFA384x_DLSTATE_FLASHENABLED ) { | ||
1025 | return -EINVAL; | ||
1026 | } | ||
1027 | |||
1028 | /* There isn't much we can do at this point, so I don't */ | ||
1029 | /* bother w/ the return value */ | ||
1030 | hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0); | ||
1031 | hw->dlstate = HFA384x_DLSTATE_DISABLED; | ||
1032 | |||
1033 | /* Disable the aux port */ | ||
1034 | hfa384x_cmd_aux_disable(hw); | ||
1035 | |||
1036 | DBFEXIT; | ||
1037 | return 0; | ||
1038 | } | ||
1039 | |||
1040 | |||
1041 | /*---------------------------------------------------------------- | ||
1042 | * hfa384x_drvr_flashdl_write | ||
1043 | * | ||
1044 | * Performs a FLASH download of a chunk of data. First checks to see | ||
1045 | * that we're in the FLASH download state, then sets the download | ||
1046 | * mode, uses the aux functions to 1) copy the data to the flash | ||
1047 | * buffer, 2) sets the download 'write flash' mode, 3) readback and | ||
1048 | * compare. Lather rinse, repeat as many times an necessary to get | ||
1049 | * all the given data into flash. | ||
1050 | * When all data has been written using this function (possibly | ||
1051 | * repeatedly), call drvr_flashdl_disable() to end the download state | ||
1052 | * and restart the MAC. | ||
1053 | * | ||
1054 | * Arguments: | ||
1055 | * hw device structure | ||
1056 | * daddr Card address to write to. (host order) | ||
1057 | * buf Ptr to data to write. | ||
1058 | * len Length of data (host order). | ||
1059 | * | ||
1060 | * Returns: | ||
1061 | * 0 success | ||
1062 | * >0 f/w reported error - f/w status code | ||
1063 | * <0 driver reported error | ||
1064 | * | ||
1065 | * Side effects: | ||
1066 | * | ||
1067 | * Call context: | ||
1068 | * process thread | ||
1069 | ----------------------------------------------------------------*/ | ||
1070 | int hfa384x_drvr_flashdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len) | ||
1071 | { | ||
1072 | int result = 0; | ||
1073 | UINT8 *verbuf; | ||
1074 | UINT32 dlbufaddr; | ||
1075 | UINT32 currlen; | ||
1076 | UINT32 currdaddr; | ||
1077 | UINT16 destlo; | ||
1078 | UINT16 desthi; | ||
1079 | int nwrites; | ||
1080 | int i; | ||
1081 | |||
1082 | DBFENTER; | ||
1083 | /* Check that we're in the flash download state */ | ||
1084 | if ( hw->dlstate != HFA384x_DLSTATE_FLASHENABLED ) { | ||
1085 | return -EINVAL; | ||
1086 | } | ||
1087 | |||
1088 | WLAN_LOG_INFO("Download %d bytes to flash @0x%06x\n", len, daddr); | ||
1089 | |||
1090 | /* Need a flat address for arithmetic */ | ||
1091 | dlbufaddr = HFA384x_ADDR_AUX_MKFLAT( | ||
1092 | hw->bufinfo.page, | ||
1093 | hw->bufinfo.offset); | ||
1094 | verbuf = kmalloc(hw->bufinfo.len, GFP_KERNEL); | ||
1095 | |||
1096 | #if 0 | ||
1097 | WLAN_LOG_WARNING("dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw->dltimeout); | ||
1098 | #endif | ||
1099 | /* Figure out how many times to to the flash prog */ | ||
1100 | nwrites = len / hw->bufinfo.len; | ||
1101 | nwrites += (len % hw->bufinfo.len) ? 1 : 0; | ||
1102 | |||
1103 | if ( verbuf == NULL ) { | ||
1104 | WLAN_LOG_ERROR("Failed to allocate flash verify buffer\n"); | ||
1105 | return 1; | ||
1106 | } | ||
1107 | /* For each */ | ||
1108 | for ( i = 0; i < nwrites; i++) { | ||
1109 | /* Get the dest address and len */ | ||
1110 | currlen = (len - (hw->bufinfo.len * i)) > hw->bufinfo.len ? | ||
1111 | hw->bufinfo.len : | ||
1112 | (len - (hw->bufinfo.len * i)); | ||
1113 | currdaddr = daddr + (hw->bufinfo.len * i); | ||
1114 | destlo = HFA384x_ADDR_CMD_MKOFF(currdaddr); | ||
1115 | desthi = HFA384x_ADDR_CMD_MKPAGE(currdaddr); | ||
1116 | WLAN_LOG_INFO("Writing %d bytes to flash @0x%06x\n", currlen, currdaddr); | ||
1117 | #if 0 | ||
1118 | WLAN_HEX_DUMP(1, "dldata", buf+(hw->bufinfo.len*i), currlen); | ||
1119 | #endif | ||
1120 | /* Set the download mode */ | ||
1121 | result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_NV, | ||
1122 | destlo, desthi, currlen); | ||
1123 | if ( result ) { | ||
1124 | WLAN_LOG_ERROR("download(NV,lo=%x,hi=%x,len=%x) " | ||
1125 | "cmd failed, result=%d. Aborting d/l\n", | ||
1126 | destlo, desthi, currlen, result); | ||
1127 | goto exit_proc; | ||
1128 | } | ||
1129 | /* copy the data to the flash buffer */ | ||
1130 | hfa384x_copy_to_aux(hw, dlbufaddr, HFA384x_AUX_CTL_EXTDS, | ||
1131 | buf+(hw->bufinfo.len*i), currlen); | ||
1132 | /* set the download 'write flash' mode */ | ||
1133 | result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_NVWRITE, 0,0,0); | ||
1134 | if ( result ) { | ||
1135 | WLAN_LOG_ERROR( | ||
1136 | "download(NVWRITE,lo=%x,hi=%x,len=%x) " | ||
1137 | "cmd failed, result=%d. Aborting d/l\n", | ||
1138 | destlo, desthi, currlen, result); | ||
1139 | goto exit_proc; | ||
1140 | } | ||
1141 | /* readback and compare, if fail...bail */ | ||
1142 | hfa384x_copy_from_aux(hw, | ||
1143 | currdaddr, HFA384x_AUX_CTL_NV, | ||
1144 | verbuf, currlen); | ||
1145 | |||
1146 | if ( memcmp(buf+(hw->bufinfo.len*i), verbuf, currlen) ) { | ||
1147 | return -EINVAL; | ||
1148 | } | ||
1149 | } | ||
1150 | |||
1151 | exit_proc: | ||
1152 | /* DOH! This kfree's for you Mark :-) My forehead hurts... */ | ||
1153 | kfree(verbuf); | ||
1154 | |||
1155 | /* Leave the firmware in the 'post-prog' mode. flashdl_disable will */ | ||
1156 | /* actually disable programming mode. Remember, that will cause the */ | ||
1157 | /* the firmware to effectively reset itself. */ | ||
1158 | |||
1159 | DBFEXIT; | ||
1160 | return result; | ||
1161 | } | ||
1162 | |||
1163 | |||
1164 | /*---------------------------------------------------------------- | ||
1165 | * hfa384x_cmd_initialize | ||
1166 | * | ||
1167 | * Issues the initialize command and sets the hw->state based | ||
1168 | * on the result. | ||
1169 | * | ||
1170 | * Arguments: | ||
1171 | * hw device structure | ||
1172 | * | ||
1173 | * Returns: | ||
1174 | * 0 success | ||
1175 | * >0 f/w reported error - f/w status code | ||
1176 | * <0 driver reported error | ||
1177 | * | ||
1178 | * Side effects: | ||
1179 | * | ||
1180 | * Call context: | ||
1181 | * process thread | ||
1182 | ----------------------------------------------------------------*/ | ||
1183 | int hfa384x_cmd_initialize(hfa384x_t *hw) | ||
1184 | { | ||
1185 | int result = 0; | ||
1186 | int i; | ||
1187 | hfa384x_metacmd_t cmd; | ||
1188 | |||
1189 | DBFENTER; | ||
1190 | |||
1191 | /* we don't want to be interrupted during the reset */ | ||
1192 | hfa384x_setreg(hw, 0, HFA384x_INTEN); | ||
1193 | hfa384x_setreg(hw, 0xffff, HFA384x_EVACK); | ||
1194 | |||
1195 | cmd.cmd = HFA384x_CMDCODE_INIT; | ||
1196 | cmd.parm0 = 0; | ||
1197 | cmd.parm1 = 0; | ||
1198 | cmd.parm2 = 0; | ||
1199 | |||
1200 | spin_lock_bh(&hw->cmdlock); | ||
1201 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1202 | spin_unlock_bh(&hw->cmdlock); | ||
1203 | |||
1204 | if ( result == 0 ) { | ||
1205 | for ( i = 0; i < HFA384x_NUMPORTS_MAX; i++) { | ||
1206 | hw->port_enabled[i] = 0; | ||
1207 | } | ||
1208 | } | ||
1209 | |||
1210 | hw->link_status = HFA384x_LINK_NOTCONNECTED; | ||
1211 | |||
1212 | DBFEXIT; | ||
1213 | return result; | ||
1214 | } | ||
1215 | |||
1216 | |||
1217 | /*---------------------------------------------------------------- | ||
1218 | * hfa384x_drvr_commtallies | ||
1219 | * | ||
1220 | * Send a commtallies inquiry to the MAC. Note that this is an async | ||
1221 | * call that will result in an info frame arriving sometime later. | ||
1222 | * | ||
1223 | * Arguments: | ||
1224 | * hw device structure | ||
1225 | * | ||
1226 | * Returns: | ||
1227 | * zero success. | ||
1228 | * | ||
1229 | * Side effects: | ||
1230 | * | ||
1231 | * Call context: | ||
1232 | * process | ||
1233 | ----------------------------------------------------------------*/ | ||
1234 | int hfa384x_drvr_commtallies( hfa384x_t *hw ) | ||
1235 | { | ||
1236 | hfa384x_metacmd_t cmd; | ||
1237 | int result; | ||
1238 | |||
1239 | DBFENTER; | ||
1240 | |||
1241 | cmd.cmd = HFA384x_CMDCODE_INQ; | ||
1242 | cmd.parm0 = HFA384x_IT_COMMTALLIES; | ||
1243 | cmd.parm1 = 0; | ||
1244 | cmd.parm2 = 0; | ||
1245 | |||
1246 | spin_lock_bh(&hw->cmdlock); | ||
1247 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1248 | spin_unlock_bh(&hw->cmdlock); | ||
1249 | |||
1250 | DBFEXIT; | ||
1251 | return result; | ||
1252 | } | ||
1253 | |||
1254 | |||
1255 | /*---------------------------------------------------------------- | ||
1256 | * hfa384x_drvr_enable | ||
1257 | * | ||
1258 | * Issues the enable command to enable communications on one of | ||
1259 | * the MACs 'ports'. Only macport 0 is valid for stations. | ||
1260 | * APs may also enable macports 1-6. Only ports that are currently | ||
1261 | * disabled may be enabled. | ||
1262 | * | ||
1263 | * Arguments: | ||
1264 | * hw device structure | ||
1265 | * macport MAC port number | ||
1266 | * | ||
1267 | * Returns: | ||
1268 | * 0 success | ||
1269 | * >0 f/w reported failure - f/w status code | ||
1270 | * <0 driver reported error (timeout|bad arg) | ||
1271 | * | ||
1272 | * Side effects: | ||
1273 | * | ||
1274 | * Call context: | ||
1275 | * process thread | ||
1276 | ----------------------------------------------------------------*/ | ||
1277 | int hfa384x_drvr_enable(hfa384x_t *hw, UINT16 macport) | ||
1278 | { | ||
1279 | int result = 0; | ||
1280 | |||
1281 | DBFENTER; | ||
1282 | if ((!hw->isap && macport != 0) || | ||
1283 | (hw->isap && !(macport <= HFA384x_PORTID_MAX)) || | ||
1284 | (hw->port_enabled[macport]) ){ | ||
1285 | result = -EINVAL; | ||
1286 | } else { | ||
1287 | result = hfa384x_cmd_enable(hw, macport); | ||
1288 | if ( result == 0 ) { | ||
1289 | hw->port_enabled[macport] = 1; | ||
1290 | } | ||
1291 | } | ||
1292 | DBFEXIT; | ||
1293 | return result; | ||
1294 | } | ||
1295 | |||
1296 | |||
1297 | /*---------------------------------------------------------------- | ||
1298 | * hfa384x_cmd_enable | ||
1299 | * | ||
1300 | * Issues the the enable command to enable communications on one of the | ||
1301 | * MACs 'ports'. | ||
1302 | * | ||
1303 | * Arguments: | ||
1304 | * hw device structure | ||
1305 | * macport MAC port number | ||
1306 | * | ||
1307 | * Returns: | ||
1308 | * 0 success | ||
1309 | * >0 f/w reported failure - f/w status code | ||
1310 | * <0 driver reported error (timeout|bad arg) | ||
1311 | * | ||
1312 | * Side effects: | ||
1313 | * | ||
1314 | * Call context: | ||
1315 | * process thread | ||
1316 | ----------------------------------------------------------------*/ | ||
1317 | int hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport) | ||
1318 | { | ||
1319 | int result = 0; | ||
1320 | hfa384x_metacmd_t cmd; | ||
1321 | |||
1322 | DBFENTER; | ||
1323 | |||
1324 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ENABLE) | | ||
1325 | HFA384x_CMD_MACPORT_SET(macport); | ||
1326 | cmd.parm0 = 0; | ||
1327 | cmd.parm1 = 0; | ||
1328 | cmd.parm2 = 0; | ||
1329 | |||
1330 | spin_lock_bh(&hw->cmdlock); | ||
1331 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1332 | spin_unlock_bh(&hw->cmdlock); | ||
1333 | |||
1334 | DBFEXIT; | ||
1335 | return result; | ||
1336 | } | ||
1337 | |||
1338 | |||
1339 | /*---------------------------------------------------------------- | ||
1340 | * hfa384x_drvr_disable | ||
1341 | * | ||
1342 | * Issues the disable command to stop communications on one of | ||
1343 | * the MACs 'ports'. Only macport 0 is valid for stations. | ||
1344 | * APs may also disable macports 1-6. Only ports that have been | ||
1345 | * previously enabled may be disabled. | ||
1346 | * | ||
1347 | * Arguments: | ||
1348 | * hw device structure | ||
1349 | * macport MAC port number (host order) | ||
1350 | * | ||
1351 | * Returns: | ||
1352 | * 0 success | ||
1353 | * >0 f/w reported failure - f/w status code | ||
1354 | * <0 driver reported error (timeout|bad arg) | ||
1355 | * | ||
1356 | * Side effects: | ||
1357 | * | ||
1358 | * Call context: | ||
1359 | * process thread | ||
1360 | ----------------------------------------------------------------*/ | ||
1361 | int hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport) | ||
1362 | { | ||
1363 | int result = 0; | ||
1364 | |||
1365 | DBFENTER; | ||
1366 | if ((!hw->isap && macport != 0) || | ||
1367 | (hw->isap && !(macport <= HFA384x_PORTID_MAX)) || | ||
1368 | !(hw->port_enabled[macport]) ){ | ||
1369 | result = -EINVAL; | ||
1370 | } else { | ||
1371 | result = hfa384x_cmd_disable(hw, macport); | ||
1372 | if ( result == 0 ) { | ||
1373 | hw->port_enabled[macport] = 0; | ||
1374 | } | ||
1375 | } | ||
1376 | DBFEXIT; | ||
1377 | return result; | ||
1378 | } | ||
1379 | |||
1380 | |||
1381 | /*---------------------------------------------------------------- | ||
1382 | * hfa384x_cmd_disable | ||
1383 | * | ||
1384 | * Issues the command to disable a port. | ||
1385 | * | ||
1386 | * Arguments: | ||
1387 | * hw device structure | ||
1388 | * macport MAC port number (host order) | ||
1389 | * | ||
1390 | * Returns: | ||
1391 | * 0 success | ||
1392 | * >0 f/w reported failure - f/w status code | ||
1393 | * <0 driver reported error (timeout|bad arg) | ||
1394 | * | ||
1395 | * Side effects: | ||
1396 | * | ||
1397 | * Call context: | ||
1398 | * process thread | ||
1399 | ----------------------------------------------------------------*/ | ||
1400 | int hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport) | ||
1401 | { | ||
1402 | int result = 0; | ||
1403 | hfa384x_metacmd_t cmd; | ||
1404 | |||
1405 | DBFENTER; | ||
1406 | |||
1407 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DISABLE) | | ||
1408 | HFA384x_CMD_MACPORT_SET(macport); | ||
1409 | cmd.parm0 = 0; | ||
1410 | cmd.parm1 = 0; | ||
1411 | cmd.parm2 = 0; | ||
1412 | |||
1413 | spin_lock_bh(&hw->cmdlock); | ||
1414 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1415 | spin_unlock_bh(&hw->cmdlock); | ||
1416 | |||
1417 | DBFEXIT; | ||
1418 | return result; | ||
1419 | } | ||
1420 | |||
1421 | |||
1422 | /*---------------------------------------------------------------- | ||
1423 | * hfa384x_cmd_diagnose | ||
1424 | * | ||
1425 | * Issues the diagnose command to test the: register interface, | ||
1426 | * MAC controller (including loopback), External RAM, Non-volatile | ||
1427 | * memory integrity, and synthesizers. Following execution of this | ||
1428 | * command, MAC/firmware are in the 'initial state'. Therefore, | ||
1429 | * the Initialize command should be issued after successful | ||
1430 | * completion of this command. This function may only be called | ||
1431 | * when the MAC is in the 'communication disabled' state. | ||
1432 | * | ||
1433 | * Arguments: | ||
1434 | * hw device structure | ||
1435 | * | ||
1436 | * Returns: | ||
1437 | * 0 success | ||
1438 | * >0 f/w reported failure - f/w status code | ||
1439 | * <0 driver reported error (timeout|bad arg) | ||
1440 | * | ||
1441 | * Side effects: | ||
1442 | * | ||
1443 | * Call context: | ||
1444 | * process thread | ||
1445 | ----------------------------------------------------------------*/ | ||
1446 | #define DIAG_PATTERNA ((UINT16)0xaaaa) | ||
1447 | #define DIAG_PATTERNB ((UINT16)0x5555) | ||
1448 | |||
1449 | int hfa384x_cmd_diagnose(hfa384x_t *hw) | ||
1450 | { | ||
1451 | int result = 0; | ||
1452 | hfa384x_metacmd_t cmd; | ||
1453 | |||
1454 | DBFENTER; | ||
1455 | |||
1456 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DIAG); | ||
1457 | cmd.parm0 = DIAG_PATTERNA; | ||
1458 | cmd.parm1 = DIAG_PATTERNB; | ||
1459 | cmd.parm2 = 0; | ||
1460 | |||
1461 | spin_lock_bh(&hw->cmdlock); | ||
1462 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1463 | spin_unlock_bh(&hw->cmdlock); | ||
1464 | |||
1465 | DBFEXIT; | ||
1466 | return result; | ||
1467 | } | ||
1468 | |||
1469 | |||
1470 | /*---------------------------------------------------------------- | ||
1471 | * hfa384x_cmd_allocate | ||
1472 | * | ||
1473 | * Issues the allocate command instructing the firmware to allocate | ||
1474 | * a 'frame structure buffer' in MAC controller RAM. This command | ||
1475 | * does not provide the result, it only initiates one of the f/w's | ||
1476 | * asynchronous processes to construct the buffer. When the | ||
1477 | * allocation is complete, it will be indicated via the Alloc | ||
1478 | * bit in the EvStat register and the FID identifying the allocated | ||
1479 | * space will be available from the AllocFID register. Some care | ||
1480 | * should be taken when waiting for the Alloc event. If a Tx or | ||
1481 | * Notify command w/ Reclaim has been previously executed, it's | ||
1482 | * possible the first Alloc event after execution of this command | ||
1483 | * will be for the reclaimed buffer and not the one you asked for. | ||
1484 | * This case must be handled in the Alloc event handler. | ||
1485 | * | ||
1486 | * Arguments: | ||
1487 | * hw device structure | ||
1488 | * len allocation length, must be an even value | ||
1489 | * in the range [4-2400]. (host order) | ||
1490 | * | ||
1491 | * Returns: | ||
1492 | * 0 success | ||
1493 | * >0 f/w reported failure - f/w status code | ||
1494 | * <0 driver reported error (timeout|bad arg) | ||
1495 | * | ||
1496 | * Side effects: | ||
1497 | * | ||
1498 | * Call context: | ||
1499 | * process thread | ||
1500 | ----------------------------------------------------------------*/ | ||
1501 | int hfa384x_cmd_allocate(hfa384x_t *hw, UINT16 len) | ||
1502 | { | ||
1503 | int result = 0; | ||
1504 | hfa384x_metacmd_t cmd; | ||
1505 | |||
1506 | DBFENTER; | ||
1507 | |||
1508 | if ( (len % 2) || | ||
1509 | len < HFA384x_CMD_ALLOC_LEN_MIN || | ||
1510 | len > HFA384x_CMD_ALLOC_LEN_MAX ) { | ||
1511 | result = -EINVAL; | ||
1512 | } else { | ||
1513 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ALLOC); | ||
1514 | cmd.parm0 = len; | ||
1515 | cmd.parm1 = 0; | ||
1516 | cmd.parm2 = 0; | ||
1517 | |||
1518 | spin_lock_bh(&hw->cmdlock); | ||
1519 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1520 | spin_unlock_bh(&hw->cmdlock); | ||
1521 | } | ||
1522 | DBFEXIT; | ||
1523 | return result; | ||
1524 | } | ||
1525 | |||
1526 | |||
1527 | /*---------------------------------------------------------------- | ||
1528 | * hfa384x_cmd_transmit | ||
1529 | * | ||
1530 | * Instructs the firmware to transmit a frame previously copied | ||
1531 | * to a given buffer. This function returns immediately, the Tx | ||
1532 | * results are available via the Tx or TxExc events (if the frame | ||
1533 | * control bits are set). The reclaim argument specifies if the | ||
1534 | * FID passed will be used by the f/w tx process or returned for | ||
1535 | * use w/ another transmit command. If reclaim is set, expect an | ||
1536 | * Alloc event signalling the availibility of the FID for reuse. | ||
1537 | * | ||
1538 | * NOTE: hw->cmdlock MUST BE HELD before calling this function! | ||
1539 | * | ||
1540 | * Arguments: | ||
1541 | * hw device structure | ||
1542 | * reclaim [0|1] indicates whether the given FID will | ||
1543 | * be handed back (via Alloc event) for reuse. | ||
1544 | * (host order) | ||
1545 | * qos [0-3] Value to put in the QoS field of the | ||
1546 | * tx command, identifies a queue to place the | ||
1547 | * outgoing frame in. | ||
1548 | * (host order) | ||
1549 | * fid FID of buffer containing the frame that was | ||
1550 | * previously copied to MAC memory via the bap. | ||
1551 | * (host order) | ||
1552 | * | ||
1553 | * Returns: | ||
1554 | * 0 success | ||
1555 | * >0 f/w reported failure - f/w status code | ||
1556 | * <0 driver reported error (timeout|bad arg) | ||
1557 | * | ||
1558 | * Side effects: | ||
1559 | * hw->resp0 will contain the FID being used by async tx | ||
1560 | * process. If reclaim==0, resp0 will be the same as the fid | ||
1561 | * argument. If reclaim==1, resp0 will be the different and | ||
1562 | * is the value to watch for in the Tx|TxExc to indicate completion | ||
1563 | * of the frame passed in fid. | ||
1564 | * | ||
1565 | * Call context: | ||
1566 | * process thread | ||
1567 | ----------------------------------------------------------------*/ | ||
1568 | int hfa384x_cmd_transmit(hfa384x_t *hw, UINT16 reclaim, UINT16 qos, UINT16 fid) | ||
1569 | { | ||
1570 | int result = 0; | ||
1571 | hfa384x_metacmd_t cmd; | ||
1572 | |||
1573 | DBFENTER; | ||
1574 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_TX) | | ||
1575 | HFA384x_CMD_RECL_SET(reclaim) | | ||
1576 | HFA384x_CMD_QOS_SET(qos); | ||
1577 | cmd.parm0 = fid; | ||
1578 | cmd.parm1 = 0; | ||
1579 | cmd.parm2 = 0; | ||
1580 | |||
1581 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1582 | |||
1583 | DBFEXIT; | ||
1584 | return result; | ||
1585 | } | ||
1586 | |||
1587 | |||
1588 | /*---------------------------------------------------------------- | ||
1589 | * hfa384x_cmd_clearpersist | ||
1590 | * | ||
1591 | * Instructs the firmware to clear the persistence bit in a given | ||
1592 | * FID. This has the effect of telling the firmware to drop the | ||
1593 | * persistent frame. The FID must be one that was previously used | ||
1594 | * to transmit a PRST frame. | ||
1595 | * | ||
1596 | * Arguments: | ||
1597 | * hw device structure | ||
1598 | * fid FID of the persistent frame (host order) | ||
1599 | * | ||
1600 | * Returns: | ||
1601 | * 0 success | ||
1602 | * >0 f/w reported failure - f/w status code | ||
1603 | * <0 driver reported error (timeout|bad arg) | ||
1604 | * | ||
1605 | * Side effects: | ||
1606 | * | ||
1607 | * Call context: | ||
1608 | * process thread | ||
1609 | ----------------------------------------------------------------*/ | ||
1610 | int hfa384x_cmd_clearpersist(hfa384x_t *hw, UINT16 fid) | ||
1611 | { | ||
1612 | int result = 0; | ||
1613 | hfa384x_metacmd_t cmd; | ||
1614 | |||
1615 | DBFENTER; | ||
1616 | |||
1617 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_CLRPRST); | ||
1618 | cmd.parm0 = fid; | ||
1619 | cmd.parm1 = 0; | ||
1620 | cmd.parm2 = 0; | ||
1621 | |||
1622 | spin_lock_bh(&hw->cmdlock); | ||
1623 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1624 | spin_unlock_bh(&hw->cmdlock); | ||
1625 | |||
1626 | DBFEXIT; | ||
1627 | return result; | ||
1628 | } | ||
1629 | |||
1630 | /*---------------------------------------------------------------- | ||
1631 | * hfa384x_cmd_notify | ||
1632 | * | ||
1633 | * Sends an info frame to the firmware to alter the behavior | ||
1634 | * of the f/w asynch processes. Can only be called when the MAC | ||
1635 | * is in the enabled state. | ||
1636 | * | ||
1637 | * Arguments: | ||
1638 | * hw device structure | ||
1639 | * reclaim [0|1] indicates whether the given FID will | ||
1640 | * be handed back (via Alloc event) for reuse. | ||
1641 | * (host order) | ||
1642 | * fid FID of buffer containing the frame that was | ||
1643 | * previously copied to MAC memory via the bap. | ||
1644 | * (host order) | ||
1645 | * | ||
1646 | * Returns: | ||
1647 | * 0 success | ||
1648 | * >0 f/w reported failure - f/w status code | ||
1649 | * <0 driver reported error (timeout|bad arg) | ||
1650 | * | ||
1651 | * Side effects: | ||
1652 | * hw->resp0 will contain the FID being used by async notify | ||
1653 | * process. If reclaim==0, resp0 will be the same as the fid | ||
1654 | * argument. If reclaim==1, resp0 will be the different. | ||
1655 | * | ||
1656 | * Call context: | ||
1657 | * process thread | ||
1658 | ----------------------------------------------------------------*/ | ||
1659 | int hfa384x_cmd_notify(hfa384x_t *hw, UINT16 reclaim, UINT16 fid, | ||
1660 | void *buf, UINT16 len) | ||
1661 | { | ||
1662 | int result = 0; | ||
1663 | hfa384x_metacmd_t cmd; | ||
1664 | |||
1665 | DBFENTER; | ||
1666 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_NOTIFY) | | ||
1667 | HFA384x_CMD_RECL_SET(reclaim); | ||
1668 | cmd.parm0 = fid; | ||
1669 | cmd.parm1 = 0; | ||
1670 | cmd.parm2 = 0; | ||
1671 | |||
1672 | spin_lock_bh(&hw->cmdlock); | ||
1673 | |||
1674 | /* Copy the record to FID */ | ||
1675 | result = hfa384x_copy_to_bap(hw, HFA384x_BAP_PROC, hw->infofid, 0, buf, len); | ||
1676 | if ( result ) { | ||
1677 | WLAN_LOG_DEBUG(1, | ||
1678 | "copy_to_bap(%04x, 0, %d) failed, result=0x%x\n", | ||
1679 | hw->infofid, len, result); | ||
1680 | result = -EIO; | ||
1681 | goto failed; | ||
1682 | } | ||
1683 | |||
1684 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1685 | |||
1686 | failed: | ||
1687 | spin_unlock_bh(&hw->cmdlock); | ||
1688 | |||
1689 | DBFEXIT; | ||
1690 | return result; | ||
1691 | } | ||
1692 | |||
1693 | |||
1694 | #if 0 | ||
1695 | /*---------------------------------------------------------------- | ||
1696 | * hfa384x_cmd_inquiry | ||
1697 | * | ||
1698 | * Requests an info frame from the firmware. The info frame will | ||
1699 | * be delivered asynchronously via the Info event. | ||
1700 | * | ||
1701 | * Arguments: | ||
1702 | * hw device structure | ||
1703 | * fid FID of the info frame requested. (host order) | ||
1704 | * | ||
1705 | * Returns: | ||
1706 | * 0 success | ||
1707 | * >0 f/w reported failure - f/w status code | ||
1708 | * <0 driver reported error (timeout|bad arg) | ||
1709 | * | ||
1710 | * Side effects: | ||
1711 | * | ||
1712 | * Call context: | ||
1713 | * process thread | ||
1714 | ----------------------------------------------------------------*/ | ||
1715 | static int hfa384x_cmd_inquiry(hfa384x_t *hw, UINT16 fid) | ||
1716 | { | ||
1717 | int result = 0; | ||
1718 | hfa384x_metacmd_t cmd; | ||
1719 | |||
1720 | DBFENTER; | ||
1721 | |||
1722 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_INQ); | ||
1723 | cmd.parm0 = fid; | ||
1724 | cmd.parm1 = 0; | ||
1725 | cmd.parm2 = 0; | ||
1726 | |||
1727 | spin_lock_bh(&hw->cmdlock); | ||
1728 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1729 | spin_unlock_bh(&hw->cmdlock); | ||
1730 | |||
1731 | DBFEXIT; | ||
1732 | return result; | ||
1733 | } | ||
1734 | #endif | ||
1735 | |||
1736 | |||
1737 | /*---------------------------------------------------------------- | ||
1738 | * hfa384x_cmd_access | ||
1739 | * | ||
1740 | * Requests that a given record be copied to/from the record | ||
1741 | * buffer. If we're writing from the record buffer, the contents | ||
1742 | * must previously have been written to the record buffer via the | ||
1743 | * bap. If we're reading into the record buffer, the record can | ||
1744 | * be read out of the record buffer after this call. | ||
1745 | * | ||
1746 | * Arguments: | ||
1747 | * hw device structure | ||
1748 | * write [0|1] copy the record buffer to the given | ||
1749 | * configuration record. (host order) | ||
1750 | * rid RID of the record to read/write. (host order) | ||
1751 | * buf host side record buffer. Upon return it will | ||
1752 | * contain the body portion of the record (minus the | ||
1753 | * RID and len). | ||
1754 | * len buffer length (in bytes, should match record length) | ||
1755 | * | ||
1756 | * Returns: | ||
1757 | * 0 success | ||
1758 | * >0 f/w reported failure - f/w status code | ||
1759 | * <0 driver reported error (timeout|bad arg) | ||
1760 | * | ||
1761 | * Side effects: | ||
1762 | * | ||
1763 | * Call context: | ||
1764 | * process thread | ||
1765 | ----------------------------------------------------------------*/ | ||
1766 | int hfa384x_cmd_access(hfa384x_t *hw, UINT16 write, UINT16 rid, | ||
1767 | void* buf, UINT16 len) | ||
1768 | { | ||
1769 | int result = 0; | ||
1770 | hfa384x_metacmd_t cmd; | ||
1771 | hfa384x_rec_t rec; | ||
1772 | |||
1773 | DBFENTER; | ||
1774 | |||
1775 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)) | ||
1776 | /* This should NOT be called in interrupt context! */ | ||
1777 | if (in_irq()) { | ||
1778 | WLAN_LOG_ERROR("Krap, in Interrupt context!"); | ||
1779 | #ifdef WLAN_INCLUDE_DEBUG | ||
1780 | BUG(); | ||
1781 | #endif | ||
1782 | } | ||
1783 | #endif | ||
1784 | spin_lock_bh(&hw->cmdlock); | ||
1785 | |||
1786 | if (write) { | ||
1787 | rec.rid = host2hfa384x_16(rid); | ||
1788 | rec.reclen = host2hfa384x_16((len/2) + 1); /* note conversion to words, +1 for rid field */ | ||
1789 | /* write the record */ | ||
1790 | result = hfa384x_copy_to_bap4( hw, HFA384x_BAP_PROC, rid, 0, | ||
1791 | &rec, sizeof(rec), | ||
1792 | buf, len, | ||
1793 | NULL, 0, NULL, 0); | ||
1794 | if ( result ) { | ||
1795 | WLAN_LOG_DEBUG(3,"Failure writing record header+data\n"); | ||
1796 | goto fail; | ||
1797 | } | ||
1798 | |||
1799 | } | ||
1800 | |||
1801 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ACCESS) | | ||
1802 | HFA384x_CMD_WRITE_SET(write); | ||
1803 | cmd.parm0 = rid; | ||
1804 | cmd.parm1 = 0; | ||
1805 | cmd.parm2 = 0; | ||
1806 | |||
1807 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1808 | if ( result ) { | ||
1809 | WLAN_LOG_ERROR("Call to hfa384x_docmd_wait failed (%d %d)\n", | ||
1810 | result, cmd.result.resp0); | ||
1811 | goto fail; | ||
1812 | } | ||
1813 | |||
1814 | if (!write) { | ||
1815 | result = hfa384x_copy_from_bap( hw, HFA384x_BAP_PROC, rid, 0, &rec, sizeof(rec)); | ||
1816 | if ( result ) { | ||
1817 | WLAN_LOG_DEBUG(3,"Call to hfa384x_copy_from_bap failed\n"); | ||
1818 | goto fail; | ||
1819 | } | ||
1820 | |||
1821 | /* Validate the record length */ | ||
1822 | if ( ((hfa384x2host_16(rec.reclen)-1)*2) != len ) { /* note body len calculation in bytes */ | ||
1823 | WLAN_LOG_DEBUG(1, "RID len mismatch, rid=0x%04x hlen=%d fwlen=%d\n", | ||
1824 | rid, len, (hfa384x2host_16(rec.reclen)-1)*2); | ||
1825 | result = -ENODATA; | ||
1826 | goto fail; | ||
1827 | } | ||
1828 | |||
1829 | result = hfa384x_copy_from_bap( hw, HFA384x_BAP_PROC, rid, sizeof(rec), buf, len); | ||
1830 | |||
1831 | } | ||
1832 | |||
1833 | fail: | ||
1834 | spin_unlock_bh(&hw->cmdlock); | ||
1835 | DBFEXIT; | ||
1836 | return result; | ||
1837 | } | ||
1838 | |||
1839 | |||
1840 | /*---------------------------------------------------------------- | ||
1841 | * hfa384x_cmd_monitor | ||
1842 | * | ||
1843 | * Enables the 'monitor mode' of the MAC. Here's the description of | ||
1844 | * monitor mode that I've received thus far: | ||
1845 | * | ||
1846 | * "The "monitor mode" of operation is that the MAC passes all | ||
1847 | * frames for which the PLCP checks are correct. All received | ||
1848 | * MPDUs are passed to the host with MAC Port = 7, with a | ||
1849 | * receive status of good, FCS error, or undecryptable. Passing | ||
1850 | * certain MPDUs is a violation of the 802.11 standard, but useful | ||
1851 | * for a debugging tool." Normal communication is not possible | ||
1852 | * while monitor mode is enabled. | ||
1853 | * | ||
1854 | * Arguments: | ||
1855 | * hw device structure | ||
1856 | * enable a code (0x0b|0x0f) that enables/disables | ||
1857 | * monitor mode. (host order) | ||
1858 | * | ||
1859 | * Returns: | ||
1860 | * 0 success | ||
1861 | * >0 f/w reported failure - f/w status code | ||
1862 | * <0 driver reported error (timeout|bad arg) | ||
1863 | * | ||
1864 | * Side effects: | ||
1865 | * | ||
1866 | * Call context: | ||
1867 | * process thread | ||
1868 | ----------------------------------------------------------------*/ | ||
1869 | int hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable) | ||
1870 | { | ||
1871 | int result = 0; | ||
1872 | hfa384x_metacmd_t cmd; | ||
1873 | |||
1874 | DBFENTER; | ||
1875 | |||
1876 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) | | ||
1877 | HFA384x_CMD_AINFO_SET(enable); | ||
1878 | cmd.parm0 = 0; | ||
1879 | cmd.parm1 = 0; | ||
1880 | cmd.parm2 = 0; | ||
1881 | |||
1882 | spin_lock_bh(&hw->cmdlock); | ||
1883 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1884 | spin_unlock_bh(&hw->cmdlock); | ||
1885 | |||
1886 | DBFEXIT; | ||
1887 | return result; | ||
1888 | } | ||
1889 | |||
1890 | |||
1891 | /*---------------------------------------------------------------- | ||
1892 | * hfa384x_cmd_download | ||
1893 | * | ||
1894 | * Sets the controls for the MAC controller code/data download | ||
1895 | * process. The arguments set the mode and address associated | ||
1896 | * with a download. Note that the aux registers should be enabled | ||
1897 | * prior to setting one of the download enable modes. | ||
1898 | * | ||
1899 | * Arguments: | ||
1900 | * hw device structure | ||
1901 | * mode 0 - Disable programming and begin code exec | ||
1902 | * 1 - Enable volatile mem programming | ||
1903 | * 2 - Enable non-volatile mem programming | ||
1904 | * 3 - Program non-volatile section from NV download | ||
1905 | * buffer. | ||
1906 | * (host order) | ||
1907 | * lowaddr | ||
1908 | * highaddr For mode 1, sets the high & low order bits of | ||
1909 | * the "destination address". This address will be | ||
1910 | * the execution start address when download is | ||
1911 | * subsequently disabled. | ||
1912 | * For mode 2, sets the high & low order bits of | ||
1913 | * the destination in NV ram. | ||
1914 | * For modes 0 & 3, should be zero. (host order) | ||
1915 | * NOTE: these address args are in CMD format | ||
1916 | * codelen Length of the data to write in mode 2, | ||
1917 | * zero otherwise. (host order) | ||
1918 | * | ||
1919 | * Returns: | ||
1920 | * 0 success | ||
1921 | * >0 f/w reported failure - f/w status code | ||
1922 | * <0 driver reported error (timeout|bad arg) | ||
1923 | * | ||
1924 | * Side effects: | ||
1925 | * | ||
1926 | * Call context: | ||
1927 | * process thread | ||
1928 | ----------------------------------------------------------------*/ | ||
1929 | int hfa384x_cmd_download(hfa384x_t *hw, UINT16 mode, UINT16 lowaddr, | ||
1930 | UINT16 highaddr, UINT16 codelen) | ||
1931 | { | ||
1932 | int result = 0; | ||
1933 | hfa384x_metacmd_t cmd; | ||
1934 | |||
1935 | DBFENTER; | ||
1936 | |||
1937 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DOWNLD) | | ||
1938 | HFA384x_CMD_PROGMODE_SET(mode); | ||
1939 | cmd.parm0 = lowaddr; | ||
1940 | cmd.parm1 = highaddr; | ||
1941 | cmd.parm2 = codelen; | ||
1942 | |||
1943 | spin_lock_bh(&hw->cmdlock); | ||
1944 | result = hfa384x_dl_docmd_wait(hw, &cmd); | ||
1945 | spin_unlock_bh(&hw->cmdlock); | ||
1946 | |||
1947 | DBFEXIT; | ||
1948 | return result; | ||
1949 | } | ||
1950 | |||
1951 | |||
1952 | /*---------------------------------------------------------------- | ||
1953 | * hfa384x_cmd_aux_enable | ||
1954 | * | ||
1955 | * Goes through the process of enabling the auxilary port. This | ||
1956 | * is necessary prior to raw reads/writes to card data space. | ||
1957 | * Direct access to the card data space is only used for downloading | ||
1958 | * code and debugging. | ||
1959 | * Note that a call to this function is required before attempting | ||
1960 | * a download. | ||
1961 | * | ||
1962 | * Arguments: | ||
1963 | * hw device structure | ||
1964 | * | ||
1965 | * Returns: | ||
1966 | * 0 success | ||
1967 | * >0 f/w reported failure - f/w status code | ||
1968 | * <0 driver reported error (timeout) | ||
1969 | * | ||
1970 | * Side effects: | ||
1971 | * | ||
1972 | * Call context: | ||
1973 | * process thread | ||
1974 | ----------------------------------------------------------------*/ | ||
1975 | int hfa384x_cmd_aux_enable(hfa384x_t *hw, int force) | ||
1976 | { | ||
1977 | int result = -ETIMEDOUT; | ||
1978 | unsigned long flags; | ||
1979 | UINT32 retries_remaining; | ||
1980 | UINT16 reg; | ||
1981 | UINT auxen_mirror = hw->auxen; | ||
1982 | |||
1983 | DBFENTER; | ||
1984 | |||
1985 | /* Check for existing enable */ | ||
1986 | if ( hw->auxen ) { | ||
1987 | hw->auxen++; | ||
1988 | return 0; | ||
1989 | } | ||
1990 | |||
1991 | /* acquire the lock */ | ||
1992 | spin_lock_irqsave( &(hw->cmdlock), flags); | ||
1993 | /* wait for cmd register busy bit to clear */ | ||
1994 | retries_remaining = 100000; | ||
1995 | do { | ||
1996 | reg = hfa384x_getreg(hw, HFA384x_CMD); | ||
1997 | udelay(10); | ||
1998 | } | ||
1999 | while (HFA384x_CMD_ISBUSY(reg) && --retries_remaining); | ||
2000 | if (retries_remaining != 0) { | ||
2001 | /* busy bit clear, it's OK to write to ParamX regs */ | ||
2002 | hfa384x_setreg(hw, HFA384x_AUXPW0, | ||
2003 | HFA384x_PARAM0); | ||
2004 | hfa384x_setreg(hw, HFA384x_AUXPW1, | ||
2005 | HFA384x_PARAM1); | ||
2006 | hfa384x_setreg(hw, HFA384x_AUXPW2, | ||
2007 | HFA384x_PARAM2); | ||
2008 | |||
2009 | /* Set the aux enable in the Control register */ | ||
2010 | hfa384x_setreg(hw, HFA384x_CONTROL_AUX_DOENABLE, | ||
2011 | HFA384x_CONTROL); | ||
2012 | |||
2013 | /* Now wait for completion */ | ||
2014 | retries_remaining = 100000; | ||
2015 | do { | ||
2016 | reg = hfa384x_getreg(hw, HFA384x_CONTROL); | ||
2017 | udelay(10); | ||
2018 | } | ||
2019 | while ( ((reg & (BIT14|BIT15)) != HFA384x_CONTROL_AUX_ISENABLED) && | ||
2020 | --retries_remaining ); | ||
2021 | if (retries_remaining != 0) { | ||
2022 | result = 0; | ||
2023 | hw->auxen++; | ||
2024 | } | ||
2025 | } | ||
2026 | |||
2027 | /* Force it enabled even if the command failed, if told.. */ | ||
2028 | if ((hw->auxen == auxen_mirror) && force) | ||
2029 | hw->auxen++; | ||
2030 | |||
2031 | spin_unlock_irqrestore( &(hw->cmdlock), flags); | ||
2032 | DBFEXIT; | ||
2033 | return result; | ||
2034 | } | ||
2035 | |||
2036 | |||
2037 | /*---------------------------------------------------------------- | ||
2038 | * hfa384x_cmd_aux_disable | ||
2039 | * | ||
2040 | * Goes through the process of disabling the auxilary port | ||
2041 | * enabled with aux_enable(). | ||
2042 | * | ||
2043 | * Arguments: | ||
2044 | * hw device structure | ||
2045 | * | ||
2046 | * Returns: | ||
2047 | * 0 success | ||
2048 | * >0 f/w reported failure - f/w status code | ||
2049 | * <0 driver reported error (timeout) | ||
2050 | * | ||
2051 | * Side effects: | ||
2052 | * | ||
2053 | * Call context: | ||
2054 | * process thread | ||
2055 | ----------------------------------------------------------------*/ | ||
2056 | int hfa384x_cmd_aux_disable(hfa384x_t *hw) | ||
2057 | { | ||
2058 | int result = -ETIMEDOUT; | ||
2059 | unsigned long timeout; | ||
2060 | UINT16 reg = 0; | ||
2061 | |||
2062 | DBFENTER; | ||
2063 | |||
2064 | /* See if there's more than one enable */ | ||
2065 | if (hw->auxen) hw->auxen--; | ||
2066 | if (hw->auxen) return 0; | ||
2067 | |||
2068 | /* Clear the aux enable in the Control register */ | ||
2069 | hfa384x_setreg(hw, 0, HFA384x_PARAM0); | ||
2070 | hfa384x_setreg(hw, 0, HFA384x_PARAM1); | ||
2071 | hfa384x_setreg(hw, 0, HFA384x_PARAM2); | ||
2072 | hfa384x_setreg(hw, HFA384x_CONTROL_AUX_DODISABLE, | ||
2073 | HFA384x_CONTROL); | ||
2074 | |||
2075 | /* Now wait for completion */ | ||
2076 | timeout = jiffies + 1*HZ; | ||
2077 | reg = hfa384x_getreg(hw, HFA384x_CONTROL); | ||
2078 | while ( ((reg & (BIT14|BIT15)) != HFA384x_CONTROL_AUX_ISDISABLED) && | ||
2079 | time_before(jiffies,timeout) ){ | ||
2080 | udelay(10); | ||
2081 | reg = hfa384x_getreg(hw, HFA384x_CONTROL); | ||
2082 | } | ||
2083 | if ((reg & (BIT14|BIT15)) == HFA384x_CONTROL_AUX_ISDISABLED ) { | ||
2084 | result = 0; | ||
2085 | } | ||
2086 | DBFEXIT; | ||
2087 | return result; | ||
2088 | } | ||
2089 | |||
2090 | /*---------------------------------------------------------------- | ||
2091 | * hfa384x_drvr_low_level | ||
2092 | * | ||
2093 | * Write test commands to the card. Some test commands don't make | ||
2094 | * sense without prior set-up. For example, continous TX isn't very | ||
2095 | * useful until you set the channel. That functionality should be | ||
2096 | * | ||
2097 | * Side effects: | ||
2098 | * | ||
2099 | * Call context: | ||
2100 | * process thread | ||
2101 | * -----------------------------------------------------------------*/ | ||
2102 | int hfa384x_drvr_low_level(hfa384x_t *hw, hfa384x_metacmd_t *cmd) | ||
2103 | { | ||
2104 | int result = 0; | ||
2105 | DBFENTER; | ||
2106 | |||
2107 | /* Do i need a host2hfa... conversion ? */ | ||
2108 | #if 0 | ||
2109 | printk(KERN_INFO "%#x %#x %#x %#x\n", cmd->cmd, cmd->parm0, cmd->parm1, cmd->parm2); | ||
2110 | #endif | ||
2111 | spin_lock_bh(&hw->cmdlock); | ||
2112 | result = hfa384x_docmd_wait(hw, cmd); | ||
2113 | spin_unlock_bh(&hw->cmdlock); | ||
2114 | |||
2115 | DBFEXIT; | ||
2116 | return result; | ||
2117 | } | ||
2118 | |||
2119 | |||
2120 | /* TODO: determine if these will ever be needed */ | ||
2121 | #if 0 | ||
2122 | int hfa384x_cmd_readmif(hfa384x_t *hw) | ||
2123 | { | ||
2124 | DBFENTER; | ||
2125 | DBFEXIT; | ||
2126 | return 0; | ||
2127 | } | ||
2128 | |||
2129 | |||
2130 | int hfa384x_cmd_writemif(hfa384x_t *hw) | ||
2131 | { | ||
2132 | DBFENTER; | ||
2133 | DBFEXIT; | ||
2134 | return 0; | ||
2135 | } | ||
2136 | #endif | ||
2137 | |||
2138 | /*---------------------------------------------------------------- | ||
2139 | * hfa384x_drvr_mmi_read | ||
2140 | * | ||
2141 | * Read mmi registers. mmi is intersil-speak for the baseband | ||
2142 | * processor registers. | ||
2143 | * | ||
2144 | * Arguments: | ||
2145 | * hw device structure | ||
2146 | * register The test register to be accessed (must be even #). | ||
2147 | * | ||
2148 | * Returns: | ||
2149 | * 0 success | ||
2150 | * >0 f/w reported error - f/w status code | ||
2151 | * <0 driver reported error | ||
2152 | * | ||
2153 | * Side effects: | ||
2154 | * | ||
2155 | * Call context: | ||
2156 | * process thread | ||
2157 | ----------------------------------------------------------------*/ | ||
2158 | int hfa384x_drvr_mmi_read(hfa384x_t *hw, UINT32 addr, UINT32 *resp) | ||
2159 | { | ||
2160 | int result = 0; | ||
2161 | hfa384x_metacmd_t cmd; | ||
2162 | |||
2163 | DBFENTER; | ||
2164 | cmd.cmd = (UINT16) 0x30; | ||
2165 | cmd.parm0 = (UINT16) addr; | ||
2166 | cmd.parm1 = 0; | ||
2167 | cmd.parm2 = 0; | ||
2168 | |||
2169 | /* Do i need a host2hfa... conversion ? */ | ||
2170 | spin_lock_bh(&hw->cmdlock); | ||
2171 | result = hfa384x_docmd_wait(hw, &cmd); | ||
2172 | spin_unlock_bh(&hw->cmdlock); | ||
2173 | |||
2174 | *resp = (UINT32) cmd.result.resp0; | ||
2175 | |||
2176 | DBFEXIT; | ||
2177 | return result; | ||
2178 | } | ||
2179 | |||
2180 | /*---------------------------------------------------------------- | ||
2181 | * hfa384x_drvr_mmi_write | ||
2182 | * | ||
2183 | * Read mmi registers. mmi is intersil-speak for the baseband | ||
2184 | * processor registers. | ||
2185 | * | ||
2186 | * Arguments: | ||
2187 | * hw device structure | ||
2188 | * addr The test register to be accessed (must be even #). | ||
2189 | * data The data value to write to the register. | ||
2190 | * | ||
2191 | * Returns: | ||
2192 | * 0 success | ||
2193 | * >0 f/w reported error - f/w status code | ||
2194 | * <0 driver reported error | ||
2195 | * | ||
2196 | * Side effects: | ||
2197 | * | ||
2198 | * Call context: | ||
2199 | * process thread | ||
2200 | ----------------------------------------------------------------*/ | ||
2201 | |||
2202 | int | ||
2203 | hfa384x_drvr_mmi_write(hfa384x_t *hw, UINT32 addr, UINT32 data) | ||
2204 | { | ||
2205 | int result = 0; | ||
2206 | hfa384x_metacmd_t cmd; | ||
2207 | |||
2208 | DBFENTER; | ||
2209 | cmd.cmd = (UINT16) 0x31; | ||
2210 | cmd.parm0 = (UINT16) addr; | ||
2211 | cmd.parm1 = (UINT16) data; | ||
2212 | cmd.parm2 = 0; | ||
2213 | |||
2214 | WLAN_LOG_DEBUG(1,"mmi write : addr = 0x%08x\n", addr); | ||
2215 | WLAN_LOG_DEBUG(1,"mmi write : data = 0x%08x\n", data); | ||
2216 | |||
2217 | /* Do i need a host2hfa... conversion ? */ | ||
2218 | spin_lock_bh(&hw->cmdlock); | ||
2219 | result = hfa384x_docmd_wait(hw, &cmd); | ||
2220 | spin_unlock_bh(&hw->cmdlock); | ||
2221 | |||
2222 | DBFEXIT; | ||
2223 | return result; | ||
2224 | } | ||
2225 | |||
2226 | |||
2227 | /* TODO: determine if these will ever be needed */ | ||
2228 | #if 0 | ||
2229 | int hfa384x_cmd_readmif(hfa384x_t *hw) | ||
2230 | { | ||
2231 | DBFENTER; | ||
2232 | DBFEXIT; | ||
2233 | return 0; | ||
2234 | } | ||
2235 | |||
2236 | |||
2237 | int hfa384x_cmd_writemif(hfa384x_t *hw) | ||
2238 | { | ||
2239 | DBFENTER; | ||
2240 | DBFEXIT; | ||
2241 | return 0; | ||
2242 | } | ||
2243 | #endif | ||
2244 | |||
2245 | |||
2246 | |||
2247 | /*---------------------------------------------------------------- | ||
2248 | * hfa384x_copy_from_bap | ||
2249 | * | ||
2250 | * Copies a collection of bytes from the MAC controller memory via | ||
2251 | * one set of BAP registers. | ||
2252 | * | ||
2253 | * Arguments: | ||
2254 | * hw device structure | ||
2255 | * bap [0|1] which BAP to use | ||
2256 | * id FID or RID, destined for the select register (host order) | ||
2257 | * offset An _even_ offset into the buffer for the given | ||
2258 | * FID/RID. We haven't the means to validate this, | ||
2259 | * so be careful. (host order) | ||
2260 | * buf ptr to array of bytes | ||
2261 | * len length of data to transfer in bytes | ||
2262 | * | ||
2263 | * Returns: | ||
2264 | * 0 success | ||
2265 | * >0 f/w reported failure - value of offset reg. | ||
2266 | * <0 driver reported error (timeout|bad arg) | ||
2267 | * | ||
2268 | * Side effects: | ||
2269 | * | ||
2270 | * Call context: | ||
2271 | * process thread | ||
2272 | * interrupt | ||
2273 | ----------------------------------------------------------------*/ | ||
2274 | int hfa384x_copy_from_bap(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset, | ||
2275 | void *buf, UINT len) | ||
2276 | { | ||
2277 | int result = 0; | ||
2278 | unsigned long flags = 0; | ||
2279 | UINT8 *d = (UINT8*)buf; | ||
2280 | UINT selectreg; | ||
2281 | UINT offsetreg; | ||
2282 | UINT datareg; | ||
2283 | UINT i; | ||
2284 | UINT16 reg = 0; | ||
2285 | |||
2286 | DBFENTER; | ||
2287 | |||
2288 | /* Validate bap, offset, buf, and len */ | ||
2289 | if ( (bap > 1) || | ||
2290 | (offset > HFA384x_BAP_OFFSET_MAX) || | ||
2291 | (offset % 2) || | ||
2292 | (buf == NULL) || | ||
2293 | (len > HFA384x_BAP_DATALEN_MAX) ){ | ||
2294 | result = -EINVAL; | ||
2295 | } else { | ||
2296 | selectreg = (bap == 1) ? HFA384x_SELECT1 : HFA384x_SELECT0 ; | ||
2297 | offsetreg = (bap == 1) ? HFA384x_OFFSET1 : HFA384x_OFFSET0 ; | ||
2298 | datareg = (bap == 1) ? HFA384x_DATA1 : HFA384x_DATA0 ; | ||
2299 | |||
2300 | /* Obtain lock */ | ||
2301 | spin_lock_irqsave( &(hw->baplock), flags); | ||
2302 | |||
2303 | /* Write id to select reg */ | ||
2304 | hfa384x_setreg(hw, id, selectreg); | ||
2305 | /* Write offset to offset reg */ | ||
2306 | hfa384x_setreg(hw, offset, offsetreg); | ||
2307 | /* Wait for offset[busy] to clear (see BAP_TIMEOUT) */ | ||
2308 | i = 0; | ||
2309 | do { | ||
2310 | reg = hfa384x_getreg(hw, offsetreg); | ||
2311 | if ( i > 0 ) udelay(10); | ||
2312 | i++; | ||
2313 | } while ( i < prism2_bap_timeout && HFA384x_OFFSET_ISBUSY(reg)); | ||
2314 | #if (WLAN_HOSTIF != WLAN_PCI) | ||
2315 | /* Release lock */ | ||
2316 | spin_unlock_irqrestore( &(hw->baplock), flags); | ||
2317 | #endif | ||
2318 | |||
2319 | if ( HFA384x_OFFSET_ISBUSY(reg) ){ | ||
2320 | /* If timeout, return -ETIMEDOUT */ | ||
2321 | result = reg; | ||
2322 | } else if ( HFA384x_OFFSET_ISERR(reg) ){ | ||
2323 | /* If offset[err] == 1, return -EINVAL */ | ||
2324 | result = reg; | ||
2325 | } else { | ||
2326 | /* Read even(len) buf contents from data reg */ | ||
2327 | for ( i = 0; i < (len & 0xfffe); i+=2 ) { | ||
2328 | *(UINT16*)(&(d[i])) = | ||
2329 | hfa384x_getreg_noswap(hw, datareg); | ||
2330 | } | ||
2331 | /* If len odd, handle last byte */ | ||
2332 | if ( len % 2 ){ | ||
2333 | reg = hfa384x_getreg_noswap(hw, datareg); | ||
2334 | d[len-1] = ((UINT8*)(®))[0]; | ||
2335 | } | ||
2336 | } | ||
2337 | |||
2338 | /* According to Intersil errata dated 9/16/02: | ||
2339 | |||
2340 | "In PRISM PCI MAC host interface, if both BAPs are concurrently | ||
2341 | requesing memory access, both will accept the Ack. There is no | ||
2342 | firmware workaround possible. To prevent BAP access failures or | ||
2343 | hang conditions the host MUST NOT access both BAPs in sucession | ||
2344 | unless at least 5us elapses between accesses. The safest choice | ||
2345 | is to USE ONLY ONE BAP for all data movement operations." | ||
2346 | |||
2347 | What this means: | ||
2348 | |||
2349 | We have to serialize ALL BAP accesses, and furthermore, add a 5us | ||
2350 | delay after access if we're using a PCI platform. | ||
2351 | |||
2352 | Unfortunately, this means we have to lock out interrupts througout | ||
2353 | the entire BAP copy. | ||
2354 | |||
2355 | It remains to be seen if "BAP access" means "BAP setup" or the more | ||
2356 | literal definition of "copying data back and forth" I'm erring for | ||
2357 | the latter, safer definition. -- SLP. | ||
2358 | |||
2359 | */ | ||
2360 | |||
2361 | #if (WLAN_HOSTIF == WLAN_PCI) | ||
2362 | udelay(5); | ||
2363 | /* Release lock */ | ||
2364 | spin_unlock_irqrestore( &(hw->baplock), flags); | ||
2365 | #endif | ||
2366 | |||
2367 | } | ||
2368 | |||
2369 | if (result) { | ||
2370 | WLAN_LOG_DEBUG(1, | ||
2371 | "copy_from_bap(0x%04x, 0, %d) failed, result=0x%x\n", | ||
2372 | reg, len, result); | ||
2373 | } | ||
2374 | DBFEXIT; | ||
2375 | return result; | ||
2376 | } | ||
2377 | |||
2378 | |||
2379 | /*---------------------------------------------------------------- | ||
2380 | * hfa384x_copy_to_bap | ||
2381 | * | ||
2382 | * Copies a collection of bytes to the MAC controller memory via | ||
2383 | * one set of BAP registers. | ||
2384 | * | ||
2385 | * Arguments: | ||
2386 | * hw device structure | ||
2387 | * bap [0|1] which BAP to use | ||
2388 | * id FID or RID, destined for the select register (host order) | ||
2389 | * offset An _even_ offset into the buffer for the given | ||
2390 | * FID/RID. We haven't the means to validate this, | ||
2391 | * so be careful. (host order) | ||
2392 | * buf ptr to array of bytes | ||
2393 | * len length of data to transfer (in bytes) | ||
2394 | * | ||
2395 | * Returns: | ||
2396 | * 0 success | ||
2397 | * >0 f/w reported failure - value of offset reg. | ||
2398 | * <0 driver reported error (timeout|bad arg) | ||
2399 | * | ||
2400 | * Side effects: | ||
2401 | * | ||
2402 | * Call context: | ||
2403 | * process thread | ||
2404 | * interrupt | ||
2405 | ----------------------------------------------------------------*/ | ||
2406 | int hfa384x_copy_to_bap(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset, | ||
2407 | void *buf, UINT len) | ||
2408 | { | ||
2409 | return hfa384x_copy_to_bap4(hw, bap, id, offset, buf, len, NULL, 0, NULL, 0, NULL, 0); | ||
2410 | } | ||
2411 | |||
2412 | int hfa384x_copy_to_bap4(hfa384x_t *hw, UINT16 bap, UINT16 id, UINT16 offset, | ||
2413 | void *buf, UINT len1, void* buf2, UINT len2, | ||
2414 | void *buf3, UINT len3, void *buf4, UINT len4) | ||
2415 | { | ||
2416 | int result = 0; | ||
2417 | unsigned long flags = 0; | ||
2418 | UINT8 *d; | ||
2419 | UINT selectreg; | ||
2420 | UINT offsetreg; | ||
2421 | UINT datareg; | ||
2422 | UINT i; | ||
2423 | UINT16 reg; | ||
2424 | |||
2425 | DBFENTER; | ||
2426 | |||
2427 | // printk(KERN_DEBUG "ctb1 %d id %04x o %d %d %d %d %d\n", bap, id, offset, len1, len2, len3, len4); | ||
2428 | |||
2429 | /* Validate bap, offset, buf, and len */ | ||
2430 | if ( (bap > 1) || | ||
2431 | (offset > HFA384x_BAP_OFFSET_MAX) || | ||
2432 | (offset % 2) || | ||
2433 | (buf == NULL) || | ||
2434 | (len1+len2+len3+len4 > HFA384x_BAP_DATALEN_MAX) ){ | ||
2435 | result = -EINVAL; | ||
2436 | } else { | ||
2437 | selectreg = (bap == 1) ? HFA384x_SELECT1 : HFA384x_SELECT0; | ||
2438 | offsetreg = (bap == 1) ? HFA384x_OFFSET1 : HFA384x_OFFSET0; | ||
2439 | datareg = (bap == 1) ? HFA384x_DATA1 : HFA384x_DATA0; | ||
2440 | /* Obtain lock */ | ||
2441 | spin_lock_irqsave( &(hw->baplock), flags); | ||
2442 | |||
2443 | /* Write id to select reg */ | ||
2444 | hfa384x_setreg(hw, id, selectreg); | ||
2445 | udelay(10); | ||
2446 | /* Write offset to offset reg */ | ||
2447 | hfa384x_setreg(hw, offset, offsetreg); | ||
2448 | /* Wait for offset[busy] to clear (see BAP_TIMEOUT) */ | ||
2449 | i = 0; | ||
2450 | do { | ||
2451 | reg = hfa384x_getreg(hw, offsetreg); | ||
2452 | if ( i > 0 ) udelay(10); | ||
2453 | i++; | ||
2454 | } while ( i < prism2_bap_timeout && HFA384x_OFFSET_ISBUSY(reg)); | ||
2455 | |||
2456 | #if (WLAN_HOSTIF != WLAN_PCI) | ||
2457 | /* Release lock */ | ||
2458 | spin_unlock_irqrestore( &(hw->baplock), flags); | ||
2459 | #endif | ||
2460 | |||
2461 | if ( HFA384x_OFFSET_ISBUSY(reg) ){ | ||
2462 | /* If timeout, return reg */ | ||
2463 | result = reg; | ||
2464 | } else if ( HFA384x_OFFSET_ISERR(reg) ){ | ||
2465 | /* If offset[err] == 1, return reg */ | ||
2466 | result = reg; | ||
2467 | } else { | ||
2468 | d = (UINT8*)buf; | ||
2469 | /* Write even(len1) buf contents to data reg */ | ||
2470 | for ( i = 0; i < (len1 & 0xfffe); i+=2 ) { | ||
2471 | hfa384x_setreg_noswap(hw, | ||
2472 | *(UINT16*)(&(d[i])), datareg); | ||
2473 | } | ||
2474 | if (len1 & 1) { | ||
2475 | UINT16 data; | ||
2476 | UINT8 *b = (UINT8 *) &data; | ||
2477 | b[0] = d[len1-1]; | ||
2478 | if (buf2 != NULL) { | ||
2479 | d = (UINT8*)buf2; | ||
2480 | b[1] = d[0]; | ||
2481 | len2--; | ||
2482 | buf2++; | ||
2483 | } | ||
2484 | hfa384x_setreg_noswap(hw, data, datareg); | ||
2485 | } | ||
2486 | if ((buf2 != NULL) && (len2 > 0)) { | ||
2487 | /* Write even(len2) buf contents to data reg */ | ||
2488 | d = (UINT8*)buf2; | ||
2489 | for ( i = 0; i < (len2 & 0xfffe); i+=2 ) { | ||
2490 | hfa384x_setreg_noswap(hw, *(UINT16*)(&(d[i])), datareg); | ||
2491 | } | ||
2492 | if (len2 & 1) { | ||
2493 | UINT16 data; | ||
2494 | UINT8 *b = (UINT8 *) &data; | ||
2495 | b[0] = d[len2-1]; | ||
2496 | if (buf3 != NULL) { | ||
2497 | d = (UINT8*)buf3; | ||
2498 | b[1] = d[0]; | ||
2499 | len3--; | ||
2500 | buf3++; | ||
2501 | } | ||
2502 | hfa384x_setreg_noswap(hw, data, datareg); | ||
2503 | } | ||
2504 | } | ||
2505 | |||
2506 | if ((buf3 != NULL) && (len3 > 0)) { | ||
2507 | /* Write even(len3) buf contents to data reg */ | ||
2508 | d = (UINT8*)buf3; | ||
2509 | for ( i = 0; i < (len3 & 0xfffe); i+=2 ) { | ||
2510 | hfa384x_setreg_noswap(hw, *(UINT16*)(&(d[i])), datareg); | ||
2511 | } | ||
2512 | if (len3 & 1) { | ||
2513 | UINT16 data; | ||
2514 | UINT8 *b = (UINT8 *) &data; | ||
2515 | b[0] = d[len3-1]; | ||
2516 | if (buf4 != NULL) { | ||
2517 | d = (UINT8*)buf4; | ||
2518 | b[1] = d[0]; | ||
2519 | len4--; | ||
2520 | buf4++; | ||
2521 | } | ||
2522 | hfa384x_setreg_noswap(hw, data, datareg); | ||
2523 | } | ||
2524 | } | ||
2525 | if ((buf4 != NULL) && (len4 > 0)) { | ||
2526 | /* Write even(len4) buf contents to data reg */ | ||
2527 | d = (UINT8*)buf4; | ||
2528 | for ( i = 0; i < (len4 & 0xfffe); i+=2 ) { | ||
2529 | hfa384x_setreg_noswap(hw, *(UINT16*)(&(d[i])), datareg); | ||
2530 | } | ||
2531 | if (len4 & 1) { | ||
2532 | UINT16 data; | ||
2533 | UINT8 *b = (UINT8 *) &data; | ||
2534 | b[0] = d[len4-1]; | ||
2535 | b[1] = 0; | ||
2536 | |||
2537 | hfa384x_setreg_noswap(hw, data, datareg); | ||
2538 | } | ||
2539 | } | ||
2540 | // printk(KERN_DEBUG "ctb2 %d id %04x o %d %d %d %d %d\n", bap, id, offset, len1, len2, len3, len4); | ||
2541 | |||
2542 | } | ||
2543 | |||
2544 | #if (WLAN_HOSTIF == WLAN_PCI) | ||
2545 | udelay(5); | ||
2546 | /* Release lock */ | ||
2547 | spin_unlock_irqrestore( &(hw->baplock), flags); | ||
2548 | #endif | ||
2549 | |||
2550 | } | ||
2551 | |||
2552 | if (result) | ||
2553 | WLAN_LOG_ERROR("copy_to_bap() failed.\n"); | ||
2554 | |||
2555 | DBFEXIT; | ||
2556 | return result; | ||
2557 | } | ||
2558 | |||
2559 | |||
2560 | /*---------------------------------------------------------------- | ||
2561 | * hfa384x_copy_from_aux | ||
2562 | * | ||
2563 | * Copies a collection of bytes from the controller memory. The | ||
2564 | * Auxiliary port MUST be enabled prior to calling this function. | ||
2565 | * We _might_ be in a download state. | ||
2566 | * | ||
2567 | * Arguments: | ||
2568 | * hw device structure | ||
2569 | * cardaddr address in hfa384x data space to read | ||
2570 | * auxctl address space select | ||
2571 | * buf ptr to destination host buffer | ||
2572 | * len length of data to transfer (in bytes) | ||
2573 | * | ||
2574 | * Returns: | ||
2575 | * nothing | ||
2576 | * | ||
2577 | * Side effects: | ||
2578 | * buf contains the data copied | ||
2579 | * | ||
2580 | * Call context: | ||
2581 | * process thread | ||
2582 | * interrupt | ||
2583 | ----------------------------------------------------------------*/ | ||
2584 | void | ||
2585 | hfa384x_copy_from_aux( | ||
2586 | hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len) | ||
2587 | { | ||
2588 | UINT16 currpage; | ||
2589 | UINT16 curroffset; | ||
2590 | UINT i = 0; | ||
2591 | |||
2592 | DBFENTER; | ||
2593 | |||
2594 | if ( !(hw->auxen) ) { | ||
2595 | WLAN_LOG_DEBUG(1, | ||
2596 | "Attempt to read 0x%04x when aux not enabled\n", | ||
2597 | cardaddr); | ||
2598 | return; | ||
2599 | |||
2600 | } | ||
2601 | /* Build appropriate aux page and offset */ | ||
2602 | currpage = HFA384x_AUX_MKPAGE(cardaddr); | ||
2603 | curroffset = HFA384x_AUX_MKOFF(cardaddr, auxctl); | ||
2604 | hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE); | ||
2605 | hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET); | ||
2606 | udelay(5); /* beat */ | ||
2607 | |||
2608 | /* read the data */ | ||
2609 | while ( i < len) { | ||
2610 | *((UINT16*)(buf+i)) = hfa384x_getreg_noswap(hw, HFA384x_AUXDATA); | ||
2611 | i+=2; | ||
2612 | curroffset+=2; | ||
2613 | if ( (curroffset&HFA384x_ADDR_AUX_OFF_MASK) > | ||
2614 | HFA384x_ADDR_AUX_OFF_MAX ) { | ||
2615 | currpage++; | ||
2616 | curroffset = 0; | ||
2617 | curroffset = HFA384x_AUX_MKOFF(curroffset, auxctl); | ||
2618 | hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE); | ||
2619 | hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET); | ||
2620 | udelay(5); /* beat */ | ||
2621 | } | ||
2622 | } | ||
2623 | /* Make sure the auxctl bits are clear */ | ||
2624 | hfa384x_setreg(hw, 0, HFA384x_AUXOFFSET); | ||
2625 | DBFEXIT; | ||
2626 | } | ||
2627 | |||
2628 | |||
2629 | /*---------------------------------------------------------------- | ||
2630 | * hfa384x_copy_to_aux | ||
2631 | * | ||
2632 | * Copies a collection of bytes to the controller memory. The | ||
2633 | * Auxiliary port MUST be enabled prior to calling this function. | ||
2634 | * We _might_ be in a download state. | ||
2635 | * | ||
2636 | * Arguments: | ||
2637 | * hw device structure | ||
2638 | * cardaddr address in hfa384x data space to read | ||
2639 | * auxctl address space select | ||
2640 | * buf ptr to destination host buffer | ||
2641 | * len length of data to transfer (in bytes) | ||
2642 | * | ||
2643 | * Returns: | ||
2644 | * nothing | ||
2645 | * | ||
2646 | * Side effects: | ||
2647 | * Controller memory now contains a copy of buf | ||
2648 | * | ||
2649 | * Call context: | ||
2650 | * process thread | ||
2651 | * interrupt | ||
2652 | ----------------------------------------------------------------*/ | ||
2653 | void | ||
2654 | hfa384x_copy_to_aux( | ||
2655 | hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len) | ||
2656 | { | ||
2657 | UINT16 currpage; | ||
2658 | UINT16 curroffset; | ||
2659 | UINT i = 0; | ||
2660 | |||
2661 | DBFENTER; | ||
2662 | |||
2663 | if ( !(hw->auxen) ) { | ||
2664 | WLAN_LOG_DEBUG(1, | ||
2665 | "Attempt to read 0x%04x when aux not enabled\n", | ||
2666 | cardaddr); | ||
2667 | return; | ||
2668 | |||
2669 | } | ||
2670 | /* Build appropriate aux page and offset */ | ||
2671 | currpage = HFA384x_AUX_MKPAGE(cardaddr); | ||
2672 | curroffset = HFA384x_AUX_MKOFF(cardaddr, auxctl); | ||
2673 | hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE); | ||
2674 | hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET); | ||
2675 | udelay(5); /* beat */ | ||
2676 | |||
2677 | /* write the data */ | ||
2678 | while ( i < len) { | ||
2679 | hfa384x_setreg_noswap(hw, | ||
2680 | *((UINT16*)(buf+i)), HFA384x_AUXDATA); | ||
2681 | i+=2; | ||
2682 | curroffset+=2; | ||
2683 | if ( curroffset > HFA384x_ADDR_AUX_OFF_MAX ) { | ||
2684 | currpage++; | ||
2685 | curroffset = 0; | ||
2686 | hfa384x_setreg(hw, currpage, HFA384x_AUXPAGE); | ||
2687 | hfa384x_setreg(hw, curroffset, HFA384x_AUXOFFSET); | ||
2688 | udelay(5); /* beat */ | ||
2689 | } | ||
2690 | } | ||
2691 | DBFEXIT; | ||
2692 | } | ||
2693 | |||
2694 | |||
2695 | /*---------------------------------------------------------------- | ||
2696 | * hfa384x_cmd_wait | ||
2697 | * | ||
2698 | * Waits for availability of the Command register, then | ||
2699 | * issues the given command. Then polls the Evstat register | ||
2700 | * waiting for command completion. Timeouts shouldn't be | ||
2701 | * possible since we're preventing overlapping commands and all | ||
2702 | * commands should be cleared and acknowledged. | ||
2703 | * | ||
2704 | * Arguments: | ||
2705 | * wlandev device structure | ||
2706 | * cmd cmd structure. Includes all arguments and result | ||
2707 | * data points. All in host order. | ||
2708 | * | ||
2709 | * Returns: | ||
2710 | * 0 success | ||
2711 | * -ETIMEDOUT timed out waiting for register ready or | ||
2712 | * command completion | ||
2713 | * >0 command indicated error, Status and Resp0-2 are | ||
2714 | * in hw structure. | ||
2715 | * | ||
2716 | * Side effects: | ||
2717 | * | ||
2718 | * | ||
2719 | * Call context: | ||
2720 | * process thread | ||
2721 | ----------------------------------------------------------------*/ | ||
2722 | static int hfa384x_docmd_wait( hfa384x_t *hw, hfa384x_metacmd_t *cmd) | ||
2723 | { | ||
2724 | int result = -ETIMEDOUT; | ||
2725 | UINT16 reg = 0; | ||
2726 | UINT16 counter; | ||
2727 | |||
2728 | DBFENTER; | ||
2729 | |||
2730 | hw->cmdflag = 0; | ||
2731 | hw->cmddata = cmd; | ||
2732 | |||
2733 | /* wait for the busy bit to clear */ | ||
2734 | counter = 0; | ||
2735 | reg = hfa384x_getreg(hw, HFA384x_CMD); | ||
2736 | while ( HFA384x_CMD_ISBUSY(reg) && | ||
2737 | (counter < 10)) { | ||
2738 | reg = hfa384x_getreg(hw, HFA384x_CMD); | ||
2739 | counter++; | ||
2740 | udelay(10); | ||
2741 | } | ||
2742 | |||
2743 | if (HFA384x_CMD_ISBUSY(reg)) { | ||
2744 | WLAN_LOG_ERROR("hfa384x_cmd timeout(1), reg=0x%0hx.\n", reg); | ||
2745 | goto failed; | ||
2746 | } | ||
2747 | if (!HFA384x_CMD_ISBUSY(reg)) { | ||
2748 | /* busy bit clear, write command */ | ||
2749 | hfa384x_setreg(hw, cmd->parm0, HFA384x_PARAM0); | ||
2750 | hfa384x_setreg(hw, cmd->parm1, HFA384x_PARAM1); | ||
2751 | hfa384x_setreg(hw, cmd->parm2, HFA384x_PARAM2); | ||
2752 | hfa384x_setreg(hw, cmd->cmd, HFA384x_CMD); | ||
2753 | |||
2754 | #ifdef CMD_IRQ | ||
2755 | |||
2756 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) | ||
2757 | while (! hw->cmdflag) | ||
2758 | interruptible_sleep_on(&hw->cmdq); | ||
2759 | #else | ||
2760 | wait_event_interruptible(hw->cmdq, hw->cmdflag); | ||
2761 | #endif | ||
2762 | result = HFA384x_STATUS_RESULT_GET(cmd->status); | ||
2763 | #else // CMD_IRQ | ||
2764 | /* Now wait for completion */ | ||
2765 | counter = 0; | ||
2766 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
2767 | /* Initialization is the problem. It takes about | ||
2768 | 100ms. "normal" commands are typically is about | ||
2769 | 200-400 us (I've never seen less than 200). Longer | ||
2770 | is better so that we're not hammering the bus. */ | ||
2771 | while ( !HFA384x_EVSTAT_ISCMD(reg) && | ||
2772 | (counter < 5000)) { | ||
2773 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
2774 | counter++; | ||
2775 | udelay(200); | ||
2776 | } | ||
2777 | |||
2778 | if ( HFA384x_EVSTAT_ISCMD(reg) ) { | ||
2779 | result = 0; | ||
2780 | cmd->result.status = hfa384x_getreg(hw, HFA384x_STATUS); | ||
2781 | cmd->result.resp0 = hfa384x_getreg(hw, HFA384x_RESP0); | ||
2782 | cmd->result.resp1 = hfa384x_getreg(hw, HFA384x_RESP1); | ||
2783 | cmd->result.resp2 = hfa384x_getreg(hw, HFA384x_RESP2); | ||
2784 | hfa384x_setreg(hw, HFA384x_EVACK_CMD, | ||
2785 | HFA384x_EVACK); | ||
2786 | result = HFA384x_STATUS_RESULT_GET(cmd->result.status); | ||
2787 | } else { | ||
2788 | WLAN_LOG_ERROR("hfa384x_cmd timeout(2), reg=0x%0hx.\n", reg); | ||
2789 | } | ||
2790 | #endif /* CMD_IRQ */ | ||
2791 | } | ||
2792 | |||
2793 | failed: | ||
2794 | hw->cmdflag = 0; | ||
2795 | hw->cmddata = NULL; | ||
2796 | |||
2797 | DBFEXIT; | ||
2798 | return result; | ||
2799 | } | ||
2800 | |||
2801 | |||
2802 | /*---------------------------------------------------------------- | ||
2803 | * hfa384x_dl_docmd_wait | ||
2804 | * | ||
2805 | * Waits for availability of the Command register, then | ||
2806 | * issues the given command. Then polls the Evstat register | ||
2807 | * waiting for command completion. Timeouts shouldn't be | ||
2808 | * possible since we're preventing overlapping commands and all | ||
2809 | * commands should be cleared and acknowledged. | ||
2810 | * | ||
2811 | * This routine is only used for downloads. Since it doesn't lock out | ||
2812 | * interrupts the system response is much better. | ||
2813 | * | ||
2814 | * Arguments: | ||
2815 | * wlandev device structure | ||
2816 | * cmd cmd structure. Includes all arguments and result | ||
2817 | * data points. All in host order. | ||
2818 | * | ||
2819 | * Returns: | ||
2820 | * 0 success | ||
2821 | * -ETIMEDOUT timed out waiting for register ready or | ||
2822 | * command completion | ||
2823 | * >0 command indicated error, Status and Resp0-2 are | ||
2824 | * in hw structure. | ||
2825 | * | ||
2826 | * Side effects: | ||
2827 | * | ||
2828 | * | ||
2829 | * Call context: | ||
2830 | * process thread | ||
2831 | ----------------------------------------------------------------*/ | ||
2832 | static int hfa384x_dl_docmd_wait( hfa384x_t *hw, hfa384x_metacmd_t *cmd) | ||
2833 | { | ||
2834 | int result = -ETIMEDOUT; | ||
2835 | unsigned long timeout; | ||
2836 | UINT16 reg = 0; | ||
2837 | |||
2838 | DBFENTER; | ||
2839 | /* wait for the busy bit to clear */ | ||
2840 | timeout = jiffies + 1*HZ; | ||
2841 | reg = hfa384x_getreg(hw, HFA384x_CMD); | ||
2842 | while ( HFA384x_CMD_ISBUSY(reg) && time_before( jiffies, timeout) ) { | ||
2843 | reg = hfa384x_getreg(hw, HFA384x_CMD); | ||
2844 | udelay(10); | ||
2845 | } | ||
2846 | if (HFA384x_CMD_ISBUSY(reg)) { | ||
2847 | WLAN_LOG_WARNING("Timed out waiting for cmd register.\n"); | ||
2848 | goto failed; | ||
2849 | } | ||
2850 | |||
2851 | if (!HFA384x_CMD_ISBUSY(reg)) { | ||
2852 | /* busy bit clear, write command */ | ||
2853 | hfa384x_setreg(hw, cmd->parm0, HFA384x_PARAM0); | ||
2854 | hfa384x_setreg(hw, cmd->parm1, HFA384x_PARAM1); | ||
2855 | hfa384x_setreg(hw, cmd->parm2, HFA384x_PARAM2); | ||
2856 | hfa384x_setreg(hw, cmd->cmd, HFA384x_CMD); | ||
2857 | |||
2858 | /* Now wait for completion */ | ||
2859 | if ( (HFA384x_CMD_CMDCODE_GET(cmd->cmd) == HFA384x_CMDCODE_DOWNLD) ) { | ||
2860 | /* dltimeout is in ms */ | ||
2861 | timeout = (((UINT32)hw->dltimeout) / 1000UL) * HZ; | ||
2862 | if ( timeout > 0 ) { | ||
2863 | timeout += jiffies; | ||
2864 | } else { | ||
2865 | timeout = jiffies + 1*HZ; | ||
2866 | } | ||
2867 | } else { | ||
2868 | timeout = jiffies + 1*HZ; | ||
2869 | } | ||
2870 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
2871 | while ( !HFA384x_EVSTAT_ISCMD(reg) && time_before(jiffies,timeout) ) { | ||
2872 | udelay(100); | ||
2873 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
2874 | } | ||
2875 | if ( HFA384x_EVSTAT_ISCMD(reg) ) { | ||
2876 | result = 0; | ||
2877 | cmd->result.status = hfa384x_getreg(hw, HFA384x_STATUS); | ||
2878 | cmd->result.resp0 = hfa384x_getreg(hw, HFA384x_RESP0); | ||
2879 | cmd->result.resp1 = hfa384x_getreg(hw, HFA384x_RESP1); | ||
2880 | cmd->result.resp2 = hfa384x_getreg(hw, HFA384x_RESP2); | ||
2881 | hfa384x_setreg(hw, HFA384x_EVACK_CMD, HFA384x_EVACK); | ||
2882 | result = HFA384x_STATUS_RESULT_GET(cmd->result.status); | ||
2883 | } | ||
2884 | } | ||
2885 | |||
2886 | failed: | ||
2887 | DBFEXIT; | ||
2888 | return result; | ||
2889 | } | ||
2890 | |||
2891 | /*---------------------------------------------------------------- | ||
2892 | * hfa384x_drvr_start | ||
2893 | * | ||
2894 | * Issues the MAC initialize command, sets up some data structures, | ||
2895 | * and enables the interrupts. After this function completes, the | ||
2896 | * low-level stuff should be ready for any/all commands. | ||
2897 | * | ||
2898 | * Arguments: | ||
2899 | * hw device structure | ||
2900 | * Returns: | ||
2901 | * 0 success | ||
2902 | * >0 f/w reported error - f/w status code | ||
2903 | * <0 driver reported error | ||
2904 | * | ||
2905 | * Side effects: | ||
2906 | * | ||
2907 | * Call context: | ||
2908 | * process thread | ||
2909 | ----------------------------------------------------------------*/ | ||
2910 | int hfa384x_drvr_start(hfa384x_t *hw) | ||
2911 | { | ||
2912 | int result = 0; | ||
2913 | UINT16 reg; | ||
2914 | int i; | ||
2915 | int j; | ||
2916 | DBFENTER; | ||
2917 | |||
2918 | /* call initialize */ | ||
2919 | result = hfa384x_cmd_initialize(hw); | ||
2920 | if (result != 0) { | ||
2921 | WLAN_LOG_ERROR("Initialize command failed.\n"); | ||
2922 | goto failed; | ||
2923 | } | ||
2924 | |||
2925 | /* make sure interrupts are disabled and any layabout events cleared */ | ||
2926 | hfa384x_setreg(hw, 0, HFA384x_INTEN); | ||
2927 | hfa384x_setreg(hw, 0xffff, HFA384x_EVACK); | ||
2928 | |||
2929 | hw->txfid_head = 0; | ||
2930 | hw->txfid_tail = 0; | ||
2931 | hw->txfid_N = HFA384x_DRVR_FIDSTACKLEN_MAX; | ||
2932 | memset(hw->txfid_queue, 0, sizeof(hw->txfid_queue)); | ||
2933 | |||
2934 | /* Allocate tx and notify FIDs */ | ||
2935 | /* First, tx */ | ||
2936 | for ( i = 0; i < HFA384x_DRVR_FIDSTACKLEN_MAX-1; i++) { | ||
2937 | result = hfa384x_cmd_allocate(hw, HFA384x_DRVR_TXBUF_MAX); | ||
2938 | if (result != 0) { | ||
2939 | WLAN_LOG_ERROR("Allocate(tx) command failed.\n"); | ||
2940 | goto failed; | ||
2941 | } | ||
2942 | j = 0; | ||
2943 | do { | ||
2944 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
2945 | udelay(10); | ||
2946 | j++; | ||
2947 | } while ( !HFA384x_EVSTAT_ISALLOC(reg) && j < 50); /* 50 is timeout */ | ||
2948 | if ( j >= 50 ) { | ||
2949 | WLAN_LOG_ERROR("Timed out waiting for evalloc(tx).\n"); | ||
2950 | result = -ETIMEDOUT; | ||
2951 | goto failed; | ||
2952 | } | ||
2953 | reg = hfa384x_getreg(hw, HFA384x_ALLOCFID); | ||
2954 | |||
2955 | txfid_queue_add(hw, reg); | ||
2956 | |||
2957 | WLAN_LOG_DEBUG(4,"hw->txfid_queue[%d]=0x%04x\n",i,reg); | ||
2958 | |||
2959 | reg = HFA384x_EVACK_ALLOC_SET(1); | ||
2960 | hfa384x_setreg(hw, reg, HFA384x_EVACK); | ||
2961 | |||
2962 | } | ||
2963 | |||
2964 | /* Now, the info frame fid */ | ||
2965 | result = hfa384x_cmd_allocate(hw, HFA384x_INFOFRM_MAXLEN); | ||
2966 | if (result != 0) { | ||
2967 | WLAN_LOG_ERROR("Allocate(tx) command failed.\n"); | ||
2968 | goto failed; | ||
2969 | } | ||
2970 | i = 0; | ||
2971 | do { | ||
2972 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
2973 | udelay(10); | ||
2974 | i++; | ||
2975 | } while ( !HFA384x_EVSTAT_ISALLOC(reg) && i < 50); /* 50 is timeout */ | ||
2976 | if ( i >= 50 ) { | ||
2977 | WLAN_LOG_ERROR("Timed out waiting for evalloc(info).\n"); | ||
2978 | result = -ETIMEDOUT; | ||
2979 | goto failed; | ||
2980 | } | ||
2981 | hw->infofid = hfa384x_getreg(hw, HFA384x_ALLOCFID); | ||
2982 | reg = HFA384x_EVACK_ALLOC_SET(1); | ||
2983 | hfa384x_setreg(hw, reg, HFA384x_EVACK); | ||
2984 | WLAN_LOG_DEBUG(4,"hw->infofid=0x%04x\n", hw->infofid); | ||
2985 | |||
2986 | /* Set swsupport regs to magic # for card presence detection */ | ||
2987 | hfa384x_setreg(hw, HFA384x_DRVR_MAGIC, HFA384x_SWSUPPORT0); | ||
2988 | |||
2989 | /* Now enable the interrupts and set the running state */ | ||
2990 | hfa384x_setreg(hw, 0xffff, HFA384x_EVSTAT); | ||
2991 | hfa384x_events_all(hw); | ||
2992 | |||
2993 | hw->state = HFA384x_STATE_RUNNING; | ||
2994 | |||
2995 | goto done; | ||
2996 | failed: | ||
2997 | WLAN_LOG_ERROR("Failed, result=%d\n", result); | ||
2998 | done: | ||
2999 | DBFEXIT; | ||
3000 | return result; | ||
3001 | } | ||
3002 | |||
3003 | |||
3004 | /*---------------------------------------------------------------- | ||
3005 | * hfa384x_drvr_stop | ||
3006 | * | ||
3007 | * Issues the initialize command to leave us in the 'reset' state. | ||
3008 | * | ||
3009 | * Arguments: | ||
3010 | * hw device structure | ||
3011 | * Returns: | ||
3012 | * 0 success | ||
3013 | * >0 f/w reported error - f/w status code | ||
3014 | * <0 driver reported error | ||
3015 | * | ||
3016 | * Side effects: | ||
3017 | * | ||
3018 | * Call context: | ||
3019 | * process thread | ||
3020 | ----------------------------------------------------------------*/ | ||
3021 | int hfa384x_drvr_stop(hfa384x_t *hw) | ||
3022 | { | ||
3023 | int result = 0; | ||
3024 | int i; | ||
3025 | DBFENTER; | ||
3026 | |||
3027 | del_timer_sync(&hw->commsqual_timer); | ||
3028 | |||
3029 | if ( hw->wlandev->hwremoved ) { | ||
3030 | /* only flush when we're shutting down for good */ | ||
3031 | flush_scheduled_work(); | ||
3032 | } | ||
3033 | |||
3034 | if (hw->state == HFA384x_STATE_RUNNING) { | ||
3035 | /* | ||
3036 | * Send the MAC initialize cmd. | ||
3037 | */ | ||
3038 | hfa384x_cmd_initialize(hw); | ||
3039 | |||
3040 | /* | ||
3041 | * Make absolutely sure interrupts are disabled and any | ||
3042 | * layabout events cleared | ||
3043 | */ | ||
3044 | hfa384x_setreg(hw, 0, HFA384x_INTEN); | ||
3045 | hfa384x_setreg(hw, 0xffff, HFA384x_EVACK); | ||
3046 | } | ||
3047 | |||
3048 | tasklet_kill(&hw->bap_tasklet); | ||
3049 | |||
3050 | hw->link_status = HFA384x_LINK_NOTCONNECTED; | ||
3051 | hw->state = HFA384x_STATE_INIT; | ||
3052 | |||
3053 | /* Clear all the port status */ | ||
3054 | for ( i = 0; i < HFA384x_NUMPORTS_MAX; i++) { | ||
3055 | hw->port_enabled[i] = 0; | ||
3056 | } | ||
3057 | |||
3058 | DBFEXIT; | ||
3059 | return result; | ||
3060 | } | ||
3061 | |||
3062 | |||
3063 | /*---------------------------------------------------------------- | ||
3064 | * hfa384x_drvr_txframe | ||
3065 | * | ||
3066 | * Takes a frame from prism2sta and queues it for transmission. | ||
3067 | * | ||
3068 | * Arguments: | ||
3069 | * hw device structure | ||
3070 | * skb packet buffer struct. Contains an 802.11 | ||
3071 | * data frame. | ||
3072 | * p80211_hdr points to the 802.11 header for the packet. | ||
3073 | * Returns: | ||
3074 | * 0 Success and more buffs available | ||
3075 | * 1 Success but no more buffs | ||
3076 | * 2 Allocation failure | ||
3077 | * 3 MAC Tx command failed | ||
3078 | * 4 Buffer full or queue busy | ||
3079 | * | ||
3080 | * Side effects: | ||
3081 | * | ||
3082 | * Call context: | ||
3083 | * process thread | ||
3084 | ----------------------------------------------------------------*/ | ||
3085 | int hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep) | ||
3086 | { | ||
3087 | hfa384x_tx_frame_t txdesc; | ||
3088 | UINT16 macq = 0; | ||
3089 | UINT16 fid; | ||
3090 | int result; | ||
3091 | |||
3092 | DBFENTER; | ||
3093 | |||
3094 | /* Build Tx frame structure */ | ||
3095 | /* Set up the control field */ | ||
3096 | memset(&txdesc, 0, sizeof(txdesc)); | ||
3097 | |||
3098 | /* Tx complete and Tx exception disable per dleach. Might be causing | ||
3099 | * buf depletion | ||
3100 | */ | ||
3101 | #define DOBOTH 1 | ||
3102 | #if DOBOTH | ||
3103 | txdesc.tx_control = | ||
3104 | HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | | ||
3105 | HFA384x_TX_TXEX_SET(1) | HFA384x_TX_TXOK_SET(1); | ||
3106 | #elif DOEXC | ||
3107 | txdesc.tx_control = | ||
3108 | HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | | ||
3109 | HFA384x_TX_TXEX_SET(1) | HFA384x_TX_TXOK_SET(0); | ||
3110 | #else | ||
3111 | txdesc.tx_control = | ||
3112 | HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | | ||
3113 | HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0); | ||
3114 | #endif | ||
3115 | |||
3116 | /* if we're using host WEP, increase size by IV+ICV */ | ||
3117 | if (p80211_wep->data) { | ||
3118 | txdesc.data_len = host2hfa384x_16(skb->len+8); | ||
3119 | // txdesc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1); | ||
3120 | } else { | ||
3121 | txdesc.data_len = host2hfa384x_16(skb->len); | ||
3122 | } | ||
3123 | |||
3124 | txdesc.tx_control = host2hfa384x_16(txdesc.tx_control); | ||
3125 | /* copy the header over to the txdesc */ | ||
3126 | memcpy(&(txdesc.frame_control), p80211_hdr, sizeof(p80211_hdr_t)); | ||
3127 | |||
3128 | /* Since tbusy is set whenever the stack is empty, there should | ||
3129 | * always be something on the stack if we get to this point. | ||
3130 | * [MSM]: NOT TRUE!!!!! so I added the test of fid below. | ||
3131 | */ | ||
3132 | |||
3133 | /* Allocate FID */ | ||
3134 | |||
3135 | fid = txfid_queue_remove(hw); | ||
3136 | |||
3137 | if ( fid == 0 ) { /* stack or queue was empty */ | ||
3138 | return 4; | ||
3139 | } | ||
3140 | |||
3141 | /* now let's get the cmdlock */ | ||
3142 | spin_lock(&hw->cmdlock); | ||
3143 | |||
3144 | /* Copy descriptor+payload to FID */ | ||
3145 | if (p80211_wep->data) { | ||
3146 | result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0, | ||
3147 | &txdesc, sizeof(txdesc), | ||
3148 | p80211_wep->iv, sizeof(p80211_wep->iv), | ||
3149 | p80211_wep->data, skb->len, | ||
3150 | p80211_wep->icv, sizeof(p80211_wep->icv)); | ||
3151 | } else { | ||
3152 | result = hfa384x_copy_to_bap4(hw, HFA384x_BAP_PROC, fid, 0, | ||
3153 | &txdesc, sizeof(txdesc), | ||
3154 | skb->data, skb->len, | ||
3155 | NULL, 0, NULL, 0); | ||
3156 | } | ||
3157 | |||
3158 | if ( result ) { | ||
3159 | WLAN_LOG_DEBUG(1, | ||
3160 | "copy_to_bap(%04x, %d, %d) failed, result=0x%x\n", | ||
3161 | fid, | ||
3162 | sizeof(txdesc), | ||
3163 | skb->len, | ||
3164 | result); | ||
3165 | |||
3166 | /* put the fid back in the queue */ | ||
3167 | txfid_queue_add(hw, fid); | ||
3168 | |||
3169 | result = 3; | ||
3170 | goto failed; | ||
3171 | } | ||
3172 | |||
3173 | /* Issue Tx command */ | ||
3174 | result = hfa384x_cmd_transmit(hw, HFA384x_TXCMD_RECL, macq, fid); | ||
3175 | |||
3176 | if ( result != 0 ) { | ||
3177 | txfid_queue_add(hw, fid); | ||
3178 | |||
3179 | WLAN_LOG_DEBUG(1,"cmd_tx(%04x) failed, result=%d\n", | ||
3180 | fid, result); | ||
3181 | result = 3; | ||
3182 | goto failed; | ||
3183 | } | ||
3184 | |||
3185 | /* indicate we haven't any buffers, int_alloc will clear */ | ||
3186 | result = txfid_queue_empty(hw); | ||
3187 | failed: | ||
3188 | |||
3189 | spin_unlock(&hw->cmdlock); | ||
3190 | |||
3191 | DBFEXIT; | ||
3192 | return result; | ||
3193 | } | ||
3194 | |||
3195 | /*---------------------------------------------------------------- | ||
3196 | * hfa384x_interrupt | ||
3197 | * | ||
3198 | * Driver interrupt handler. | ||
3199 | * | ||
3200 | * Arguments: | ||
3201 | * irq irq number | ||
3202 | * dev_id pointer to the device | ||
3203 | * regs registers | ||
3204 | * | ||
3205 | * Returns: | ||
3206 | * nothing | ||
3207 | * | ||
3208 | * Side effects: | ||
3209 | * May result in a frame being passed up the stack or an info | ||
3210 | * frame being handled. | ||
3211 | * | ||
3212 | * Call context: | ||
3213 | * Ummm, could it be interrupt? | ||
3214 | ----------------------------------------------------------------*/ | ||
3215 | irqreturn_t hfa384x_interrupt(int irq, void *dev_id PT_REGS) | ||
3216 | { | ||
3217 | int reg; | ||
3218 | wlandevice_t *wlandev = (wlandevice_t*)dev_id; | ||
3219 | hfa384x_t *hw = wlandev->priv; | ||
3220 | int ev_read = 0; | ||
3221 | DBFENTER; | ||
3222 | |||
3223 | if (!wlandev || wlandev->hwremoved) | ||
3224 | return IRQ_NONE; /* Not much we can do w/o hardware */ | ||
3225 | #if (WLAN_HOSTIF == WLAN_PCMCIA) | ||
3226 | if (hw->iobase == 0) /* XXX FIXME Properly */ | ||
3227 | return IRQ_NONE; | ||
3228 | #endif | ||
3229 | |||
3230 | for (;;ev_read++) { | ||
3231 | if (ev_read >= prism2_irq_evread_max) | ||
3232 | break; | ||
3233 | |||
3234 | /* Check swsupport reg magic # for card presence */ | ||
3235 | reg = hfa384x_getreg(hw, HFA384x_SWSUPPORT0); | ||
3236 | if ( reg != HFA384x_DRVR_MAGIC) { | ||
3237 | WLAN_LOG_DEBUG(2, "irq=%d, no magic. Card removed?.\n", irq); | ||
3238 | break; | ||
3239 | } | ||
3240 | |||
3241 | /* read the EvStat register for interrupt enabled events */ | ||
3242 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
3243 | |||
3244 | /* AND with the enabled interrupts */ | ||
3245 | reg &= hfa384x_getreg(hw, HFA384x_INTEN); | ||
3246 | |||
3247 | /* Handle the events */ | ||
3248 | if ( HFA384x_EVSTAT_ISWTERR(reg) ){ | ||
3249 | WLAN_LOG_ERROR( | ||
3250 | "Error: WTERR interrupt received (unhandled).\n"); | ||
3251 | hfa384x_setreg(hw, HFA384x_EVACK_WTERR_SET(1), | ||
3252 | HFA384x_EVACK); | ||
3253 | } | ||
3254 | |||
3255 | if ( HFA384x_EVSTAT_ISINFDROP(reg) ){ | ||
3256 | hfa384x_int_infdrop(wlandev); | ||
3257 | hfa384x_setreg(hw, HFA384x_EVACK_INFDROP_SET(1), | ||
3258 | HFA384x_EVACK); | ||
3259 | } | ||
3260 | |||
3261 | if (HFA384x_EVSTAT_ISBAP_OP(reg)) { | ||
3262 | /* Disable the BAP interrupts */ | ||
3263 | hfa384x_events_nobap(hw); | ||
3264 | tasklet_schedule(&hw->bap_tasklet); | ||
3265 | } | ||
3266 | |||
3267 | if ( HFA384x_EVSTAT_ISALLOC(reg) ){ | ||
3268 | hfa384x_int_alloc(wlandev); | ||
3269 | hfa384x_setreg(hw, HFA384x_EVACK_ALLOC_SET(1), | ||
3270 | HFA384x_EVACK); | ||
3271 | } | ||
3272 | |||
3273 | if ( HFA384x_EVSTAT_ISDTIM(reg) ){ | ||
3274 | hfa384x_int_dtim(wlandev); | ||
3275 | hfa384x_setreg(hw, HFA384x_EVACK_DTIM_SET(1), | ||
3276 | HFA384x_EVACK); | ||
3277 | } | ||
3278 | #ifdef CMD_IRQ | ||
3279 | if ( HFA384x_EVSTAT_ISCMD(reg) ){ | ||
3280 | hfa384x_int_cmd(wlandev); | ||
3281 | hfa384x_setreg(hw, HFA384x_EVACK_CMD_SET(1), | ||
3282 | HFA384x_EVACK); | ||
3283 | } | ||
3284 | #endif | ||
3285 | |||
3286 | /* allow the evstat to be updated after the evack */ | ||
3287 | udelay(20); | ||
3288 | } | ||
3289 | |||
3290 | DBFEXIT; | ||
3291 | return IRQ_HANDLED; | ||
3292 | } | ||
3293 | |||
3294 | #ifdef CMD_IRQ | ||
3295 | /*---------------------------------------------------------------- | ||
3296 | * hfa384x_int_cmd | ||
3297 | * | ||
3298 | * Handles command completion event. | ||
3299 | * | ||
3300 | * Arguments: | ||
3301 | * wlandev wlan device structure | ||
3302 | * | ||
3303 | * Returns: | ||
3304 | * nothing | ||
3305 | * | ||
3306 | * Side effects: | ||
3307 | * | ||
3308 | * Call context: | ||
3309 | * interrupt | ||
3310 | ----------------------------------------------------------------*/ | ||
3311 | void hfa384x_int_cmd(wlandevice_t *wlandev) | ||
3312 | { | ||
3313 | hfa384x_t *hw = wlandev->priv; | ||
3314 | DBFENTER; | ||
3315 | |||
3316 | // check to make sure it's the right command? | ||
3317 | if (hw->cmddata) { | ||
3318 | hw->cmddata->status = hfa384x_getreg(hw, HFA384x_STATUS); | ||
3319 | hw->cmddata->resp0 = hfa384x_getreg(hw, HFA384x_RESP0); | ||
3320 | hw->cmddata->resp1 = hfa384x_getreg(hw, HFA384x_RESP1); | ||
3321 | hw->cmddata->resp2 = hfa384x_getreg(hw, HFA384x_RESP2); | ||
3322 | } | ||
3323 | hw->cmdflag = 1; | ||
3324 | |||
3325 | printk(KERN_INFO "um. int_cmd\n"); | ||
3326 | |||
3327 | wake_up_interruptible(&hw->cmdq); | ||
3328 | |||
3329 | // XXXX perform a bap copy too? | ||
3330 | |||
3331 | DBFEXIT; | ||
3332 | return; | ||
3333 | } | ||
3334 | #endif | ||
3335 | |||
3336 | /*---------------------------------------------------------------- | ||
3337 | * hfa384x_int_dtim | ||
3338 | * | ||
3339 | * Handles the DTIM early warning event. | ||
3340 | * | ||
3341 | * Arguments: | ||
3342 | * wlandev wlan device structure | ||
3343 | * | ||
3344 | * Returns: | ||
3345 | * nothing | ||
3346 | * | ||
3347 | * Side effects: | ||
3348 | * | ||
3349 | * Call context: | ||
3350 | * interrupt | ||
3351 | ----------------------------------------------------------------*/ | ||
3352 | static void hfa384x_int_dtim(wlandevice_t *wlandev) | ||
3353 | { | ||
3354 | #if 0 | ||
3355 | hfa384x_t *hw = wlandev->priv; | ||
3356 | #endif | ||
3357 | DBFENTER; | ||
3358 | prism2sta_ev_dtim(wlandev); | ||
3359 | DBFEXIT; | ||
3360 | return; | ||
3361 | } | ||
3362 | |||
3363 | |||
3364 | /*---------------------------------------------------------------- | ||
3365 | * hfa384x_int_infdrop | ||
3366 | * | ||
3367 | * Handles the InfDrop event. | ||
3368 | * | ||
3369 | * Arguments: | ||
3370 | * wlandev wlan device structure | ||
3371 | * | ||
3372 | * Returns: | ||
3373 | * nothing | ||
3374 | * | ||
3375 | * Side effects: | ||
3376 | * | ||
3377 | * Call context: | ||
3378 | * interrupt | ||
3379 | ----------------------------------------------------------------*/ | ||
3380 | static void hfa384x_int_infdrop(wlandevice_t *wlandev) | ||
3381 | { | ||
3382 | #if 0 | ||
3383 | hfa384x_t *hw = wlandev->priv; | ||
3384 | #endif | ||
3385 | DBFENTER; | ||
3386 | prism2sta_ev_infdrop(wlandev); | ||
3387 | DBFEXIT; | ||
3388 | return; | ||
3389 | } | ||
3390 | |||
3391 | |||
3392 | /*---------------------------------------------------------------- | ||
3393 | * hfa384x_int_info | ||
3394 | * | ||
3395 | * Handles the Info event. | ||
3396 | * | ||
3397 | * Arguments: | ||
3398 | * wlandev wlan device structure | ||
3399 | * | ||
3400 | * Returns: | ||
3401 | * nothing | ||
3402 | * | ||
3403 | * Side effects: | ||
3404 | * | ||
3405 | * Call context: | ||
3406 | * tasklet | ||
3407 | ----------------------------------------------------------------*/ | ||
3408 | static void hfa384x_int_info(wlandevice_t *wlandev) | ||
3409 | { | ||
3410 | hfa384x_t *hw = wlandev->priv; | ||
3411 | UINT16 reg; | ||
3412 | hfa384x_InfFrame_t inf; | ||
3413 | int result; | ||
3414 | DBFENTER; | ||
3415 | /* Retrieve the FID */ | ||
3416 | reg = hfa384x_getreg(hw, HFA384x_INFOFID); | ||
3417 | |||
3418 | /* Retrieve the length */ | ||
3419 | result = hfa384x_copy_from_bap( hw, | ||
3420 | HFA384x_BAP_INT, reg, 0, &inf.framelen, sizeof(UINT16)); | ||
3421 | if ( result ) { | ||
3422 | WLAN_LOG_DEBUG(1, | ||
3423 | "copy_from_bap(0x%04x, 0, %d) failed, result=0x%x\n", | ||
3424 | reg, sizeof(inf), result); | ||
3425 | goto failed; | ||
3426 | } | ||
3427 | inf.framelen = hfa384x2host_16(inf.framelen); | ||
3428 | |||
3429 | /* Retrieve the rest */ | ||
3430 | result = hfa384x_copy_from_bap( hw, | ||
3431 | HFA384x_BAP_INT, reg, sizeof(UINT16), | ||
3432 | &(inf.infotype), inf.framelen * sizeof(UINT16)); | ||
3433 | if ( result ) { | ||
3434 | WLAN_LOG_DEBUG(1, | ||
3435 | "copy_from_bap(0x%04x, 0, %d) failed, result=0x%x\n", | ||
3436 | reg, sizeof(inf), result); | ||
3437 | goto failed; | ||
3438 | } | ||
3439 | |||
3440 | prism2sta_ev_info(wlandev, &inf); | ||
3441 | failed: | ||
3442 | DBFEXIT; | ||
3443 | return; | ||
3444 | } | ||
3445 | |||
3446 | |||
3447 | /*---------------------------------------------------------------- | ||
3448 | * hfa384x_int_txexc | ||
3449 | * | ||
3450 | * Handles the TxExc event. A Transmit Exception event indicates | ||
3451 | * that the MAC's TX process was unsuccessful - so the packet did | ||
3452 | * not get transmitted. | ||
3453 | * | ||
3454 | * Arguments: | ||
3455 | * wlandev wlan device structure | ||
3456 | * | ||
3457 | * Returns: | ||
3458 | * nothing | ||
3459 | * | ||
3460 | * Side effects: | ||
3461 | * | ||
3462 | * Call context: | ||
3463 | * tasklet | ||
3464 | ----------------------------------------------------------------*/ | ||
3465 | static void hfa384x_int_txexc(wlandevice_t *wlandev) | ||
3466 | { | ||
3467 | hfa384x_t *hw = wlandev->priv; | ||
3468 | UINT16 status; | ||
3469 | UINT16 fid; | ||
3470 | int result = 0; | ||
3471 | DBFENTER; | ||
3472 | /* Collect the status and display */ | ||
3473 | fid = hfa384x_getreg(hw, HFA384x_TXCOMPLFID); | ||
3474 | result = hfa384x_copy_from_bap(hw, HFA384x_BAP_INT, fid, 0, &status, sizeof(status)); | ||
3475 | if ( result ) { | ||
3476 | WLAN_LOG_DEBUG(1, | ||
3477 | "copy_from_bap(0x%04x, 0, %d) failed, result=0x%x\n", | ||
3478 | fid, sizeof(status), result); | ||
3479 | goto failed; | ||
3480 | } | ||
3481 | status = hfa384x2host_16(status); | ||
3482 | prism2sta_ev_txexc(wlandev, status); | ||
3483 | failed: | ||
3484 | DBFEXIT; | ||
3485 | return; | ||
3486 | } | ||
3487 | |||
3488 | |||
3489 | /*---------------------------------------------------------------- | ||
3490 | * hfa384x_int_tx | ||
3491 | * | ||
3492 | * Handles the Tx event. | ||
3493 | * | ||
3494 | * Arguments: | ||
3495 | * wlandev wlan device structure | ||
3496 | * | ||
3497 | * Returns: | ||
3498 | * nothing | ||
3499 | * | ||
3500 | * Side effects: | ||
3501 | * | ||
3502 | * Call context: | ||
3503 | * tasklet | ||
3504 | ----------------------------------------------------------------*/ | ||
3505 | static void hfa384x_int_tx(wlandevice_t *wlandev) | ||
3506 | { | ||
3507 | hfa384x_t *hw = wlandev->priv; | ||
3508 | UINT16 fid; | ||
3509 | UINT16 status; | ||
3510 | int result = 0; | ||
3511 | DBFENTER; | ||
3512 | fid = hfa384x_getreg(hw, HFA384x_TXCOMPLFID); | ||
3513 | result = hfa384x_copy_from_bap(hw, HFA384x_BAP_INT, fid, 0, &status, sizeof(status)); | ||
3514 | if ( result ) { | ||
3515 | WLAN_LOG_DEBUG(1, | ||
3516 | "copy_from_bap(0x%04x, 0, %d) failed, result=0x%x\n", | ||
3517 | fid, sizeof(status), result); | ||
3518 | goto failed; | ||
3519 | } | ||
3520 | status = hfa384x2host_16(status); | ||
3521 | prism2sta_ev_tx(wlandev, status); | ||
3522 | failed: | ||
3523 | DBFEXIT; | ||
3524 | return; | ||
3525 | } | ||
3526 | |||
3527 | /*---------------------------------------------------------------- | ||
3528 | * hfa384x_int_rx | ||
3529 | * | ||
3530 | * Handles the Rx event. | ||
3531 | * | ||
3532 | * Arguments: | ||
3533 | * wlandev wlan device structure | ||
3534 | * | ||
3535 | * Returns: | ||
3536 | * nothing | ||
3537 | * | ||
3538 | * Side effects: | ||
3539 | * | ||
3540 | * Call context: | ||
3541 | * tasklet | ||
3542 | ----------------------------------------------------------------*/ | ||
3543 | static void hfa384x_int_rx(wlandevice_t *wlandev) | ||
3544 | { | ||
3545 | hfa384x_t *hw = wlandev->priv; | ||
3546 | UINT16 rxfid; | ||
3547 | hfa384x_rx_frame_t rxdesc; | ||
3548 | int result; | ||
3549 | int hdrlen; | ||
3550 | UINT16 fc; | ||
3551 | p80211_rxmeta_t *rxmeta; | ||
3552 | struct sk_buff *skb = NULL; | ||
3553 | UINT8 *datap; | ||
3554 | |||
3555 | DBFENTER; | ||
3556 | |||
3557 | /* Get the FID */ | ||
3558 | rxfid = hfa384x_getreg(hw, HFA384x_RXFID); | ||
3559 | /* Get the descriptor (including headers) */ | ||
3560 | result = hfa384x_copy_from_bap(hw, | ||
3561 | HFA384x_BAP_INT, | ||
3562 | rxfid, | ||
3563 | 0, | ||
3564 | &rxdesc, | ||
3565 | sizeof(rxdesc)); | ||
3566 | if ( result ) { | ||
3567 | WLAN_LOG_DEBUG(1, | ||
3568 | "copy_from_bap(0x%04x, %d, %d) failed, result=0x%x\n", | ||
3569 | rxfid, | ||
3570 | 0, | ||
3571 | sizeof(rxdesc), | ||
3572 | result); | ||
3573 | goto done; | ||
3574 | } | ||
3575 | |||
3576 | /* Byte order convert once up front. */ | ||
3577 | rxdesc.status = hfa384x2host_16(rxdesc.status); | ||
3578 | rxdesc.time = hfa384x2host_32(rxdesc.time); | ||
3579 | |||
3580 | /* drop errors and whatnot in promisc mode */ | ||
3581 | if (( wlandev->netdev->flags & IFF_PROMISC ) && | ||
3582 | (HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) || | ||
3583 | HFA384x_RXSTATUS_ISUNDECR(rxdesc.status))) | ||
3584 | goto done; | ||
3585 | |||
3586 | /* Now handle frame based on port# */ | ||
3587 | switch( HFA384x_RXSTATUS_MACPORT_GET(rxdesc.status) ) | ||
3588 | { | ||
3589 | case 0: | ||
3590 | |||
3591 | fc = ieee2host16(rxdesc.frame_control); | ||
3592 | |||
3593 | /* If exclude and we receive an unencrypted, drop it */ | ||
3594 | if ( (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) && | ||
3595 | !WLAN_GET_FC_ISWEP(fc)) { | ||
3596 | goto done; | ||
3597 | } | ||
3598 | |||
3599 | hdrlen = p80211_headerlen(fc); | ||
3600 | |||
3601 | /* Allocate the buffer, note CRC (aka FCS). pballoc */ | ||
3602 | /* assumes there needs to be space for one */ | ||
3603 | skb = dev_alloc_skb(hfa384x2host_16(rxdesc.data_len) + hdrlen + WLAN_CRC_LEN + 2); /* a little extra */ | ||
3604 | |||
3605 | if ( ! skb ) { | ||
3606 | WLAN_LOG_ERROR("alloc_skb failed.\n"); | ||
3607 | goto done; | ||
3608 | } | ||
3609 | |||
3610 | skb->dev = wlandev->netdev; | ||
3611 | |||
3612 | /* theoretically align the IP header on a 32-bit word. */ | ||
3613 | if ( hdrlen == WLAN_HDR_A4_LEN ) | ||
3614 | skb_reserve(skb, 2); | ||
3615 | |||
3616 | /* Copy the 802.11 hdr to the buffer */ | ||
3617 | datap = skb_put(skb, WLAN_HDR_A3_LEN); | ||
3618 | memcpy(datap, &rxdesc.frame_control, WLAN_HDR_A3_LEN); | ||
3619 | |||
3620 | /* Snag the A4 address if present */ | ||
3621 | if (hdrlen == WLAN_HDR_A4_LEN) { | ||
3622 | datap = skb_put(skb, WLAN_ADDR_LEN); | ||
3623 | memcpy(datap, &rxdesc.address4, WLAN_HDR_A3_LEN); | ||
3624 | } | ||
3625 | |||
3626 | /* we can convert the data_len as we passed the original on */ | ||
3627 | rxdesc.data_len = hfa384x2host_16(rxdesc.data_len); | ||
3628 | |||
3629 | /* Copy the payload data to the buffer */ | ||
3630 | if ( rxdesc.data_len > 0 ) { | ||
3631 | datap = skb_put(skb, rxdesc.data_len); | ||
3632 | result = hfa384x_copy_from_bap(hw, | ||
3633 | HFA384x_BAP_INT, rxfid, HFA384x_RX_DATA_OFF, | ||
3634 | datap, rxdesc.data_len); | ||
3635 | if ( result ) { | ||
3636 | WLAN_LOG_DEBUG(1, | ||
3637 | "copy_from_bap(0x%04x, %d, %d) failed, result=0x%x\n", | ||
3638 | rxfid, | ||
3639 | HFA384x_RX_DATA_OFF, | ||
3640 | rxdesc.data_len, | ||
3641 | result); | ||
3642 | goto failed; | ||
3643 | } | ||
3644 | } | ||
3645 | /* the prism2 cards don't return the FCS */ | ||
3646 | datap = skb_put(skb, WLAN_CRC_LEN); | ||
3647 | memset (datap, 0xff, WLAN_CRC_LEN); | ||
3648 | skb_reset_mac_header(skb); | ||
3649 | |||
3650 | /* Attach the rxmeta, set some stuff */ | ||
3651 | p80211skb_rxmeta_attach(wlandev, skb); | ||
3652 | rxmeta = P80211SKB_RXMETA(skb); | ||
3653 | rxmeta->mactime = rxdesc.time; | ||
3654 | rxmeta->rxrate = rxdesc.rate; | ||
3655 | rxmeta->signal = rxdesc.signal - hw->dbmadjust; | ||
3656 | rxmeta->noise = rxdesc.silence - hw->dbmadjust; | ||
3657 | |||
3658 | prism2sta_ev_rx(wlandev, skb); | ||
3659 | goto done; | ||
3660 | case 7: | ||
3661 | |||
3662 | if ( ! HFA384x_RXSTATUS_ISFCSERR(rxdesc.status) ) { | ||
3663 | hfa384x_int_rxmonitor( wlandev, rxfid, &rxdesc); | ||
3664 | } else { | ||
3665 | WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n"); | ||
3666 | } | ||
3667 | goto done; | ||
3668 | |||
3669 | default: | ||
3670 | |||
3671 | WLAN_LOG_WARNING("Received frame on unsupported port=%d\n", | ||
3672 | HFA384x_RXSTATUS_MACPORT_GET(rxdesc.status) ); | ||
3673 | goto done; | ||
3674 | } | ||
3675 | |||
3676 | failed: | ||
3677 | dev_kfree_skb(skb); | ||
3678 | |||
3679 | done: | ||
3680 | DBFEXIT; | ||
3681 | return; | ||
3682 | } | ||
3683 | |||
3684 | |||
3685 | /*---------------------------------------------------------------- | ||
3686 | * hfa384x_int_rxmonitor | ||
3687 | * | ||
3688 | * Helper function for int_rx. Handles monitor frames. | ||
3689 | * Note that this function allocates space for the FCS and sets it | ||
3690 | * to 0xffffffff. The hfa384x doesn't give us the FCS value but the | ||
3691 | * higher layers expect it. 0xffffffff is used as a flag to indicate | ||
3692 | * the FCS is bogus. | ||
3693 | * | ||
3694 | * Arguments: | ||
3695 | * wlandev wlan device structure | ||
3696 | * rxfid received FID | ||
3697 | * rxdesc rx descriptor read from card in int_rx | ||
3698 | * | ||
3699 | * Returns: | ||
3700 | * nothing | ||
3701 | * | ||
3702 | * Side effects: | ||
3703 | * Allocates an skb and passes it up via the PF_PACKET interface. | ||
3704 | * Call context: | ||
3705 | * interrupt | ||
3706 | ----------------------------------------------------------------*/ | ||
3707 | static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, UINT16 rxfid, | ||
3708 | hfa384x_rx_frame_t *rxdesc) | ||
3709 | { | ||
3710 | hfa384x_t *hw = wlandev->priv; | ||
3711 | UINT hdrlen = 0; | ||
3712 | UINT datalen = 0; | ||
3713 | UINT skblen = 0; | ||
3714 | UINT truncated = 0; | ||
3715 | UINT8 *datap; | ||
3716 | UINT16 fc; | ||
3717 | struct sk_buff *skb; | ||
3718 | |||
3719 | DBFENTER; | ||
3720 | /* Don't forget the status, time, and data_len fields are in host order */ | ||
3721 | /* Figure out how big the frame is */ | ||
3722 | fc = ieee2host16(rxdesc->frame_control); | ||
3723 | hdrlen = p80211_headerlen(fc); | ||
3724 | datalen = hfa384x2host_16(rxdesc->data_len); | ||
3725 | |||
3726 | /* Allocate an ind message+framesize skb */ | ||
3727 | skblen = sizeof(p80211msg_lnxind_wlansniffrm_t) + | ||
3728 | hdrlen + datalen + WLAN_CRC_LEN; | ||
3729 | |||
3730 | /* sanity check the length */ | ||
3731 | if ( skblen > | ||
3732 | (sizeof(p80211msg_lnxind_wlansniffrm_t) + | ||
3733 | WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) ) { | ||
3734 | WLAN_LOG_DEBUG(1, "overlen frm: len=%d\n", | ||
3735 | skblen - sizeof(p80211msg_lnxind_wlansniffrm_t)); | ||
3736 | } | ||
3737 | |||
3738 | if ( (skb = dev_alloc_skb(skblen)) == NULL ) { | ||
3739 | WLAN_LOG_ERROR("alloc_skb failed trying to allocate %d bytes\n", skblen); | ||
3740 | return; | ||
3741 | } | ||
3742 | |||
3743 | /* only prepend the prism header if in the right mode */ | ||
3744 | if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) && | ||
3745 | (hw->sniffhdr == 0)) { | ||
3746 | p80211msg_lnxind_wlansniffrm_t *msg; | ||
3747 | datap = skb_put(skb, sizeof(p80211msg_lnxind_wlansniffrm_t)); | ||
3748 | msg = (p80211msg_lnxind_wlansniffrm_t*) datap; | ||
3749 | |||
3750 | /* Initialize the message members */ | ||
3751 | msg->msgcode = DIDmsg_lnxind_wlansniffrm; | ||
3752 | msg->msglen = sizeof(p80211msg_lnxind_wlansniffrm_t); | ||
3753 | strcpy(msg->devname, wlandev->name); | ||
3754 | |||
3755 | msg->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; | ||
3756 | msg->hosttime.status = 0; | ||
3757 | msg->hosttime.len = 4; | ||
3758 | msg->hosttime.data = jiffies; | ||
3759 | |||
3760 | msg->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime; | ||
3761 | msg->mactime.status = 0; | ||
3762 | msg->mactime.len = 4; | ||
3763 | msg->mactime.data = rxdesc->time * 1000; | ||
3764 | |||
3765 | msg->channel.did = DIDmsg_lnxind_wlansniffrm_channel; | ||
3766 | msg->channel.status = 0; | ||
3767 | msg->channel.len = 4; | ||
3768 | msg->channel.data = hw->sniff_channel; | ||
3769 | |||
3770 | msg->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi; | ||
3771 | msg->rssi.status = P80211ENUM_msgitem_status_no_value; | ||
3772 | msg->rssi.len = 4; | ||
3773 | msg->rssi.data = 0; | ||
3774 | |||
3775 | msg->sq.did = DIDmsg_lnxind_wlansniffrm_sq; | ||
3776 | msg->sq.status = P80211ENUM_msgitem_status_no_value; | ||
3777 | msg->sq.len = 4; | ||
3778 | msg->sq.data = 0; | ||
3779 | |||
3780 | msg->signal.did = DIDmsg_lnxind_wlansniffrm_signal; | ||
3781 | msg->signal.status = 0; | ||
3782 | msg->signal.len = 4; | ||
3783 | msg->signal.data = rxdesc->signal; | ||
3784 | |||
3785 | msg->noise.did = DIDmsg_lnxind_wlansniffrm_noise; | ||
3786 | msg->noise.status = 0; | ||
3787 | msg->noise.len = 4; | ||
3788 | msg->noise.data = rxdesc->silence; | ||
3789 | |||
3790 | msg->rate.did = DIDmsg_lnxind_wlansniffrm_rate; | ||
3791 | msg->rate.status = 0; | ||
3792 | msg->rate.len = 4; | ||
3793 | msg->rate.data = rxdesc->rate / 5; /* set to 802.11 units */ | ||
3794 | |||
3795 | msg->istx.did = DIDmsg_lnxind_wlansniffrm_istx; | ||
3796 | msg->istx.status = 0; | ||
3797 | msg->istx.len = 4; | ||
3798 | msg->istx.data = P80211ENUM_truth_false; | ||
3799 | |||
3800 | msg->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen; | ||
3801 | msg->frmlen.status = 0; | ||
3802 | msg->frmlen.len = 4; | ||
3803 | msg->frmlen.data = hdrlen + datalen + WLAN_CRC_LEN; | ||
3804 | } else if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) && | ||
3805 | (hw->sniffhdr != 0)) { | ||
3806 | p80211_caphdr_t *caphdr; | ||
3807 | /* The NEW header format! */ | ||
3808 | datap = skb_put(skb, sizeof(p80211_caphdr_t)); | ||
3809 | caphdr = (p80211_caphdr_t*) datap; | ||
3810 | |||
3811 | caphdr->version = htonl(P80211CAPTURE_VERSION); | ||
3812 | caphdr->length = htonl(sizeof(p80211_caphdr_t)); | ||
3813 | caphdr->mactime = __cpu_to_be64(rxdesc->time); | ||
3814 | caphdr->hosttime = __cpu_to_be64(jiffies); | ||
3815 | caphdr->phytype = htonl(4); /* dss_dot11_b */ | ||
3816 | caphdr->channel = htonl(hw->sniff_channel); | ||
3817 | caphdr->datarate = htonl(rxdesc->rate); | ||
3818 | caphdr->antenna = htonl(0); /* unknown */ | ||
3819 | caphdr->priority = htonl(0); /* unknown */ | ||
3820 | caphdr->ssi_type = htonl(3); /* rssi_raw */ | ||
3821 | caphdr->ssi_signal = htonl(rxdesc->signal); | ||
3822 | caphdr->ssi_noise = htonl(rxdesc->silence); | ||
3823 | caphdr->preamble = htonl(0); /* unknown */ | ||
3824 | caphdr->encoding = htonl(1); /* cck */ | ||
3825 | } | ||
3826 | /* Copy the 802.11 header to the skb (ctl frames may be less than a full header) */ | ||
3827 | datap = skb_put(skb, hdrlen); | ||
3828 | memcpy( datap, &(rxdesc->frame_control), hdrlen); | ||
3829 | |||
3830 | /* If any, copy the data from the card to the skb */ | ||
3831 | if ( datalen > 0 ) | ||
3832 | { | ||
3833 | /* Truncate the packet if the user wants us to */ | ||
3834 | UINT dataread = datalen; | ||
3835 | if(hw->sniff_truncate > 0 && dataread > hw->sniff_truncate) { | ||
3836 | dataread = hw->sniff_truncate; | ||
3837 | truncated = 1; | ||
3838 | } | ||
3839 | |||
3840 | datap = skb_put(skb, dataread); | ||
3841 | hfa384x_copy_from_bap(hw, | ||
3842 | HFA384x_BAP_INT, rxfid, HFA384x_RX_DATA_OFF, | ||
3843 | datap, dataread); | ||
3844 | |||
3845 | /* check for unencrypted stuff if WEP bit set. */ | ||
3846 | if (*(datap - hdrlen + 1) & 0x40) // wep set | ||
3847 | if ((*(datap) == 0xaa) && (*(datap+1) == 0xaa)) | ||
3848 | *(datap - hdrlen + 1) &= 0xbf; // clear wep; it's the 802.2 header! | ||
3849 | } | ||
3850 | |||
3851 | if (!truncated && hw->sniff_fcs) { | ||
3852 | /* Set the FCS */ | ||
3853 | datap = skb_put(skb, WLAN_CRC_LEN); | ||
3854 | memset( datap, 0xff, WLAN_CRC_LEN); | ||
3855 | } | ||
3856 | |||
3857 | /* pass it back up */ | ||
3858 | prism2sta_ev_rx(wlandev, skb); | ||
3859 | |||
3860 | DBFEXIT; | ||
3861 | return; | ||
3862 | } | ||
3863 | |||
3864 | /*---------------------------------------------------------------- | ||
3865 | * hfa384x_int_alloc | ||
3866 | * | ||
3867 | * Handles the Alloc event. | ||
3868 | * | ||
3869 | * Arguments: | ||
3870 | * wlandev wlan device structure | ||
3871 | * | ||
3872 | * Returns: | ||
3873 | * nothing | ||
3874 | * | ||
3875 | * Side effects: | ||
3876 | * | ||
3877 | * Call context: | ||
3878 | * interrupt | ||
3879 | ----------------------------------------------------------------*/ | ||
3880 | static void hfa384x_int_alloc(wlandevice_t *wlandev) | ||
3881 | { | ||
3882 | hfa384x_t *hw = wlandev->priv; | ||
3883 | UINT16 fid; | ||
3884 | INT16 result; | ||
3885 | |||
3886 | DBFENTER; | ||
3887 | |||
3888 | /* Handle the reclaimed FID */ | ||
3889 | /* collect the FID and push it onto the stack */ | ||
3890 | fid = hfa384x_getreg(hw, HFA384x_ALLOCFID); | ||
3891 | |||
3892 | if ( fid != hw->infofid ) { /* It's a transmit fid */ | ||
3893 | WLAN_LOG_DEBUG(5, "int_alloc(%#x)\n", fid); | ||
3894 | result = txfid_queue_add(hw, fid); | ||
3895 | if (result != -1) { | ||
3896 | prism2sta_ev_alloc(wlandev); | ||
3897 | WLAN_LOG_DEBUG(5, "q_add.\n"); | ||
3898 | } else { | ||
3899 | WLAN_LOG_DEBUG(5, "q_full.\n"); | ||
3900 | } | ||
3901 | } else { | ||
3902 | /* unlock the info fid */ | ||
3903 | up(&hw->infofid_sem); | ||
3904 | } | ||
3905 | |||
3906 | DBFEXIT; | ||
3907 | return; | ||
3908 | } | ||
3909 | |||
3910 | |||
3911 | /*---------------------------------------------------------------- | ||
3912 | * hfa384x_drvr_handover | ||
3913 | * | ||
3914 | * Sends a handover notification to the MAC. | ||
3915 | * | ||
3916 | * Arguments: | ||
3917 | * hw device structure | ||
3918 | * addr address of station that's left | ||
3919 | * | ||
3920 | * Returns: | ||
3921 | * zero success. | ||
3922 | * -ERESTARTSYS received signal while waiting for semaphore. | ||
3923 | * -EIO failed to write to bap, or failed in cmd. | ||
3924 | * | ||
3925 | * Side effects: | ||
3926 | * | ||
3927 | * Call context: | ||
3928 | * process thread, NOTE: this call may block on a semaphore! | ||
3929 | ----------------------------------------------------------------*/ | ||
3930 | int hfa384x_drvr_handover( hfa384x_t *hw, UINT8 *addr) | ||
3931 | { | ||
3932 | int result = 0; | ||
3933 | hfa384x_HandoverAddr_t rec; | ||
3934 | UINT len; | ||
3935 | DBFENTER; | ||
3936 | |||
3937 | /* Acquire the infofid */ | ||
3938 | if ( down_interruptible(&hw->infofid_sem) ) { | ||
3939 | result = -ERESTARTSYS; | ||
3940 | goto failed; | ||
3941 | } | ||
3942 | |||
3943 | /* Set up the record */ | ||
3944 | len = sizeof(hfa384x_HandoverAddr_t); | ||
3945 | rec.framelen = host2hfa384x_16(len/2 - 1); | ||
3946 | rec.infotype = host2hfa384x_16(HFA384x_IT_HANDOVERADDR); | ||
3947 | memcpy(rec.handover_addr, addr, sizeof(rec.handover_addr)); | ||
3948 | |||
3949 | /* Issue the command */ | ||
3950 | result = hfa384x_cmd_notify(hw, 1, hw->infofid, &rec, len); | ||
3951 | |||
3952 | if ( result != 0 ) { | ||
3953 | WLAN_LOG_DEBUG(1,"cmd_notify(%04x) failed, result=%d", | ||
3954 | hw->infofid, result); | ||
3955 | result = -EIO; | ||
3956 | goto failed; | ||
3957 | } | ||
3958 | |||
3959 | failed: | ||
3960 | DBFEXIT; | ||
3961 | return result; | ||
3962 | } | ||
3963 | |||
3964 | void hfa384x_tx_timeout(wlandevice_t *wlandev) | ||
3965 | { | ||
3966 | DBFENTER; | ||
3967 | |||
3968 | WLAN_LOG_WARNING("Implement me.\n"); | ||
3969 | |||
3970 | DBFEXIT; | ||
3971 | } | ||
3972 | |||
3973 | /* Handles all "rx" BAP operations */ | ||
3974 | static void hfa384x_bap_tasklet(unsigned long data) | ||
3975 | { | ||
3976 | hfa384x_t *hw = (hfa384x_t *) data; | ||
3977 | wlandevice_t *wlandev = hw->wlandev; | ||
3978 | int counter = prism2_irq_evread_max; | ||
3979 | int reg; | ||
3980 | |||
3981 | DBFENTER; | ||
3982 | |||
3983 | while (counter-- > 0) { | ||
3984 | /* Get interrupt register */ | ||
3985 | reg = hfa384x_getreg(hw, HFA384x_EVSTAT); | ||
3986 | |||
3987 | if ((reg == 0xffff) || | ||
3988 | !(reg & HFA384x_INT_BAP_OP)) { | ||
3989 | break; | ||
3990 | } | ||
3991 | |||
3992 | if ( HFA384x_EVSTAT_ISINFO(reg) ){ | ||
3993 | hfa384x_int_info(wlandev); | ||
3994 | hfa384x_setreg(hw, HFA384x_EVACK_INFO_SET(1), | ||
3995 | HFA384x_EVACK); | ||
3996 | } | ||
3997 | if ( HFA384x_EVSTAT_ISTXEXC(reg) ){ | ||
3998 | hfa384x_int_txexc(wlandev); | ||
3999 | hfa384x_setreg(hw, HFA384x_EVACK_TXEXC_SET(1), | ||
4000 | HFA384x_EVACK); | ||
4001 | } | ||
4002 | if ( HFA384x_EVSTAT_ISTX(reg) ){ | ||
4003 | hfa384x_int_tx(wlandev); | ||
4004 | hfa384x_setreg(hw, HFA384x_EVACK_TX_SET(1), | ||
4005 | HFA384x_EVACK); | ||
4006 | } | ||
4007 | if ( HFA384x_EVSTAT_ISRX(reg) ){ | ||
4008 | hfa384x_int_rx(wlandev); | ||
4009 | hfa384x_setreg(hw, HFA384x_EVACK_RX_SET(1), | ||
4010 | HFA384x_EVACK); | ||
4011 | } | ||
4012 | } | ||
4013 | |||
4014 | /* re-enable interrupts */ | ||
4015 | hfa384x_events_all(hw); | ||
4016 | |||
4017 | DBFEXIT; | ||
4018 | } | ||
diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h new file mode 100644 index 000000000000..a2054639d24b --- /dev/null +++ b/drivers/staging/wlan-ng/hfa384x.h | |||
@@ -0,0 +1,3067 @@ | |||
1 | /* hfa384x.h | ||
2 | * | ||
3 | * Defines the constants and data structures for the hfa384x | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * [Implementation and usage notes] | ||
48 | * | ||
49 | * [References] | ||
50 | * CW10 Programmer's Manual v1.5 | ||
51 | * IEEE 802.11 D10.0 | ||
52 | * | ||
53 | * -------------------------------------------------------------------- | ||
54 | */ | ||
55 | |||
56 | #ifndef _HFA384x_H | ||
57 | #define _HFA384x_H | ||
58 | |||
59 | /*=============================================================*/ | ||
60 | #define HFA384x_FIRMWARE_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
61 | |||
62 | #define HFA384x_LEVEL_TO_dBm(v) (0x100 + (v) * 100 / 255 - 100) | ||
63 | |||
64 | /*------ Constants --------------------------------------------*/ | ||
65 | /*--- Mins & Maxs -----------------------------------*/ | ||
66 | #define HFA384x_CMD_ALLOC_LEN_MIN ((UINT16)4) | ||
67 | #define HFA384x_CMD_ALLOC_LEN_MAX ((UINT16)2400) | ||
68 | #define HFA384x_BAP_DATALEN_MAX ((UINT16)4096) | ||
69 | #define HFA384x_BAP_OFFSET_MAX ((UINT16)4096) | ||
70 | #define HFA384x_PORTID_MAX ((UINT16)7) | ||
71 | #define HFA384x_NUMPORTS_MAX ((UINT16)(HFA384x_PORTID_MAX+1)) | ||
72 | #define HFA384x_PDR_LEN_MAX ((UINT16)512) /* in bytes, from EK */ | ||
73 | #define HFA384x_PDA_RECS_MAX ((UINT16)200) /* a guess */ | ||
74 | #define HFA384x_PDA_LEN_MAX ((UINT16)1024) /* in bytes, from EK */ | ||
75 | #define HFA384x_SCANRESULT_MAX ((UINT16)31) | ||
76 | #define HFA384x_HSCANRESULT_MAX ((UINT16)31) | ||
77 | #define HFA384x_CHINFORESULT_MAX ((UINT16)16) | ||
78 | #define HFA384x_DRVR_FIDSTACKLEN_MAX (10) | ||
79 | #define HFA384x_DRVR_TXBUF_MAX (sizeof(hfa384x_tx_frame_t) + \ | ||
80 | WLAN_DATA_MAXLEN - \ | ||
81 | WLAN_WEP_IV_LEN - \ | ||
82 | WLAN_WEP_ICV_LEN + 2) | ||
83 | #define HFA384x_DRVR_MAGIC (0x4a2d) | ||
84 | #define HFA384x_INFODATA_MAXLEN (sizeof(hfa384x_infodata_t)) | ||
85 | #define HFA384x_INFOFRM_MAXLEN (sizeof(hfa384x_InfFrame_t)) | ||
86 | #define HFA384x_RID_GUESSING_MAXLEN 2048 /* I'm not really sure */ | ||
87 | #define HFA384x_RIDDATA_MAXLEN HFA384x_RID_GUESSING_MAXLEN | ||
88 | #define HFA384x_USB_RWMEM_MAXLEN 2048 | ||
89 | |||
90 | /*--- Support Constants -----------------------------*/ | ||
91 | #define HFA384x_BAP_PROC ((UINT16)0) | ||
92 | #define HFA384x_BAP_INT ((UINT16)1) | ||
93 | #define HFA384x_PORTTYPE_IBSS ((UINT16)0) | ||
94 | #define HFA384x_PORTTYPE_BSS ((UINT16)1) | ||
95 | #define HFA384x_PORTTYPE_WDS ((UINT16)2) | ||
96 | #define HFA384x_PORTTYPE_PSUEDOIBSS ((UINT16)3) | ||
97 | #define HFA384x_PORTTYPE_HOSTAP ((UINT16)6) | ||
98 | #define HFA384x_WEPFLAGS_PRIVINVOKED ((UINT16)BIT0) | ||
99 | #define HFA384x_WEPFLAGS_EXCLUDE ((UINT16)BIT1) | ||
100 | #define HFA384x_WEPFLAGS_DISABLE_TXCRYPT ((UINT16)BIT4) | ||
101 | #define HFA384x_WEPFLAGS_DISABLE_RXCRYPT ((UINT16)BIT7) | ||
102 | #define HFA384x_WEPFLAGS_DISALLOW_MIXED ((UINT16)BIT11) | ||
103 | #define HFA384x_WEPFLAGS_IV_INTERVAL1 ((UINT16)0) | ||
104 | #define HFA384x_WEPFLAGS_IV_INTERVAL10 ((UINT16)BIT5) | ||
105 | #define HFA384x_WEPFLAGS_IV_INTERVAL50 ((UINT16)BIT6) | ||
106 | #define HFA384x_WEPFLAGS_IV_INTERVAL100 ((UINT16)(BIT5 | BIT6)) | ||
107 | #define HFA384x_WEPFLAGS_FIRMWARE_WPA ((UINT16)BIT8) | ||
108 | #define HFA384x_WEPFLAGS_HOST_MIC ((UINT16)BIT9) | ||
109 | #define HFA384x_ROAMMODE_FWSCAN_FWROAM ((UINT16)1) | ||
110 | #define HFA384x_ROAMMODE_FWSCAN_HOSTROAM ((UINT16)2) | ||
111 | #define HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM ((UINT16)3) | ||
112 | #define HFA384x_PORTSTATUS_DISABLED ((UINT16)1) | ||
113 | #define HFA384x_PORTSTATUS_INITSRCH ((UINT16)2) | ||
114 | #define HFA384x_PORTSTATUS_CONN_IBSS ((UINT16)3) | ||
115 | #define HFA384x_PORTSTATUS_CONN_ESS ((UINT16)4) | ||
116 | #define HFA384x_PORTSTATUS_OOR_ESS ((UINT16)5) | ||
117 | #define HFA384x_PORTSTATUS_CONN_WDS ((UINT16)6) | ||
118 | #define HFA384x_PORTSTATUS_HOSTAP ((UINT16)8) | ||
119 | #define HFA384x_RATEBIT_1 ((UINT16)1) | ||
120 | #define HFA384x_RATEBIT_2 ((UINT16)2) | ||
121 | #define HFA384x_RATEBIT_5dot5 ((UINT16)4) | ||
122 | #define HFA384x_RATEBIT_11 ((UINT16)8) | ||
123 | |||
124 | /*--- Just some symbolic names for legibility -------*/ | ||
125 | #define HFA384x_TXCMD_NORECL ((UINT16)0) | ||
126 | #define HFA384x_TXCMD_RECL ((UINT16)1) | ||
127 | |||
128 | /*--- MAC Internal memory constants and macros ------*/ | ||
129 | /* masks and macros used to manipulate MAC internal memory addresses. */ | ||
130 | /* MAC internal memory addresses are 23 bit quantities. The MAC uses | ||
131 | * a paged address space where the upper 16 bits are the page number | ||
132 | * and the lower 7 bits are the offset. There are various Host API | ||
133 | * elements that require two 16-bit quantities to specify a MAC | ||
134 | * internal memory address. Unfortunately, some of the API's use a | ||
135 | * page/offset format where the offset value is JUST the lower seven | ||
136 | * bits and the page is the remaining 16 bits. Some of the API's | ||
137 | * assume that the 23 bit address has been split at the 16th bit. We | ||
138 | * refer to these two formats as AUX format and CMD format. The | ||
139 | * macros below help handle some of this. | ||
140 | */ | ||
141 | |||
142 | /* Handy constant */ | ||
143 | #define HFA384x_ADDR_AUX_OFF_MAX ((UINT16)0x007f) | ||
144 | |||
145 | /* Mask bits for discarding unwanted pieces in a flat address */ | ||
146 | #define HFA384x_ADDR_FLAT_AUX_PAGE_MASK (0x007fff80) | ||
147 | #define HFA384x_ADDR_FLAT_AUX_OFF_MASK (0x0000007f) | ||
148 | #define HFA384x_ADDR_FLAT_CMD_PAGE_MASK (0xffff0000) | ||
149 | #define HFA384x_ADDR_FLAT_CMD_OFF_MASK (0x0000ffff) | ||
150 | |||
151 | /* Mask bits for discarding unwanted pieces in AUX format 16-bit address parts */ | ||
152 | #define HFA384x_ADDR_AUX_PAGE_MASK (0xffff) | ||
153 | #define HFA384x_ADDR_AUX_OFF_MASK (0x007f) | ||
154 | |||
155 | /* Mask bits for discarding unwanted pieces in CMD format 16-bit address parts */ | ||
156 | #define HFA384x_ADDR_CMD_PAGE_MASK (0x007f) | ||
157 | #define HFA384x_ADDR_CMD_OFF_MASK (0xffff) | ||
158 | |||
159 | /* Make a 32-bit flat address from AUX format 16-bit page and offset */ | ||
160 | #define HFA384x_ADDR_AUX_MKFLAT(p,o) \ | ||
161 | (((UINT32)(((UINT16)(p))&HFA384x_ADDR_AUX_PAGE_MASK)) <<7) | \ | ||
162 | ((UINT32)(((UINT16)(o))&HFA384x_ADDR_AUX_OFF_MASK)) | ||
163 | |||
164 | /* Make a 32-bit flat address from CMD format 16-bit page and offset */ | ||
165 | #define HFA384x_ADDR_CMD_MKFLAT(p,o) \ | ||
166 | (((UINT32)(((UINT16)(p))&HFA384x_ADDR_CMD_PAGE_MASK)) <<16) | \ | ||
167 | ((UINT32)(((UINT16)(o))&HFA384x_ADDR_CMD_OFF_MASK)) | ||
168 | |||
169 | /* Make AUX format offset and page from a 32-bit flat address */ | ||
170 | #define HFA384x_ADDR_AUX_MKPAGE(f) \ | ||
171 | ((UINT16)((((UINT32)(f))&HFA384x_ADDR_FLAT_AUX_PAGE_MASK)>>7)) | ||
172 | #define HFA384x_ADDR_AUX_MKOFF(f) \ | ||
173 | ((UINT16)(((UINT32)(f))&HFA384x_ADDR_FLAT_AUX_OFF_MASK)) | ||
174 | |||
175 | /* Make CMD format offset and page from a 32-bit flat address */ | ||
176 | #define HFA384x_ADDR_CMD_MKPAGE(f) \ | ||
177 | ((UINT16)((((UINT32)(f))&HFA384x_ADDR_FLAT_CMD_PAGE_MASK)>>16)) | ||
178 | #define HFA384x_ADDR_CMD_MKOFF(f) \ | ||
179 | ((UINT16)(((UINT32)(f))&HFA384x_ADDR_FLAT_CMD_OFF_MASK)) | ||
180 | |||
181 | /*--- Aux register masks/tests ----------------------*/ | ||
182 | /* Some of the upper bits of the AUX offset register are used to */ | ||
183 | /* select address space. */ | ||
184 | #define HFA384x_AUX_CTL_EXTDS (0x00) | ||
185 | #define HFA384x_AUX_CTL_NV (0x01) | ||
186 | #define HFA384x_AUX_CTL_PHY (0x02) | ||
187 | #define HFA384x_AUX_CTL_ICSRAM (0x03) | ||
188 | |||
189 | /* Make AUX register offset and page values from a flat address */ | ||
190 | #define HFA384x_AUX_MKOFF(f, c) \ | ||
191 | (HFA384x_ADDR_AUX_MKOFF(f) | (((UINT16)(c))<<12)) | ||
192 | #define HFA384x_AUX_MKPAGE(f) HFA384x_ADDR_AUX_MKPAGE(f) | ||
193 | |||
194 | |||
195 | /*--- Controller Memory addresses -------------------*/ | ||
196 | #define HFA3842_PDA_BASE (0x007f0000UL) | ||
197 | #define HFA3841_PDA_BASE (0x003f0000UL) | ||
198 | #define HFA3841_PDA_BOGUS_BASE (0x00390000UL) | ||
199 | |||
200 | /*--- Driver Download states -----------------------*/ | ||
201 | #define HFA384x_DLSTATE_DISABLED 0 | ||
202 | #define HFA384x_DLSTATE_RAMENABLED 1 | ||
203 | #define HFA384x_DLSTATE_FLASHENABLED 2 | ||
204 | #define HFA384x_DLSTATE_FLASHWRITTEN 3 | ||
205 | #define HFA384x_DLSTATE_FLASHWRITEPENDING 4 | ||
206 | #define HFA384x_DLSTATE_GENESIS 5 | ||
207 | |||
208 | /*--- Register I/O offsets --------------------------*/ | ||
209 | #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) | ||
210 | |||
211 | #define HFA384x_CMD_OFF (0x00) | ||
212 | #define HFA384x_PARAM0_OFF (0x02) | ||
213 | #define HFA384x_PARAM1_OFF (0x04) | ||
214 | #define HFA384x_PARAM2_OFF (0x06) | ||
215 | #define HFA384x_STATUS_OFF (0x08) | ||
216 | #define HFA384x_RESP0_OFF (0x0A) | ||
217 | #define HFA384x_RESP1_OFF (0x0C) | ||
218 | #define HFA384x_RESP2_OFF (0x0E) | ||
219 | #define HFA384x_INFOFID_OFF (0x10) | ||
220 | #define HFA384x_RXFID_OFF (0x20) | ||
221 | #define HFA384x_ALLOCFID_OFF (0x22) | ||
222 | #define HFA384x_TXCOMPLFID_OFF (0x24) | ||
223 | #define HFA384x_SELECT0_OFF (0x18) | ||
224 | #define HFA384x_OFFSET0_OFF (0x1C) | ||
225 | #define HFA384x_DATA0_OFF (0x36) | ||
226 | #define HFA384x_SELECT1_OFF (0x1A) | ||
227 | #define HFA384x_OFFSET1_OFF (0x1E) | ||
228 | #define HFA384x_DATA1_OFF (0x38) | ||
229 | #define HFA384x_EVSTAT_OFF (0x30) | ||
230 | #define HFA384x_INTEN_OFF (0x32) | ||
231 | #define HFA384x_EVACK_OFF (0x34) | ||
232 | #define HFA384x_CONTROL_OFF (0x14) | ||
233 | #define HFA384x_SWSUPPORT0_OFF (0x28) | ||
234 | #define HFA384x_SWSUPPORT1_OFF (0x2A) | ||
235 | #define HFA384x_SWSUPPORT2_OFF (0x2C) | ||
236 | #define HFA384x_AUXPAGE_OFF (0x3A) | ||
237 | #define HFA384x_AUXOFFSET_OFF (0x3C) | ||
238 | #define HFA384x_AUXDATA_OFF (0x3E) | ||
239 | |||
240 | #elif (WLAN_HOSTIF == WLAN_PCI || WLAN_HOSTIF == WLAN_USB) | ||
241 | |||
242 | #define HFA384x_CMD_OFF (0x00) | ||
243 | #define HFA384x_PARAM0_OFF (0x04) | ||
244 | #define HFA384x_PARAM1_OFF (0x08) | ||
245 | #define HFA384x_PARAM2_OFF (0x0c) | ||
246 | #define HFA384x_STATUS_OFF (0x10) | ||
247 | #define HFA384x_RESP0_OFF (0x14) | ||
248 | #define HFA384x_RESP1_OFF (0x18) | ||
249 | #define HFA384x_RESP2_OFF (0x1c) | ||
250 | #define HFA384x_INFOFID_OFF (0x20) | ||
251 | #define HFA384x_RXFID_OFF (0x40) | ||
252 | #define HFA384x_ALLOCFID_OFF (0x44) | ||
253 | #define HFA384x_TXCOMPLFID_OFF (0x48) | ||
254 | #define HFA384x_SELECT0_OFF (0x30) | ||
255 | #define HFA384x_OFFSET0_OFF (0x38) | ||
256 | #define HFA384x_DATA0_OFF (0x6c) | ||
257 | #define HFA384x_SELECT1_OFF (0x34) | ||
258 | #define HFA384x_OFFSET1_OFF (0x3c) | ||
259 | #define HFA384x_DATA1_OFF (0x70) | ||
260 | #define HFA384x_EVSTAT_OFF (0x60) | ||
261 | #define HFA384x_INTEN_OFF (0x64) | ||
262 | #define HFA384x_EVACK_OFF (0x68) | ||
263 | #define HFA384x_CONTROL_OFF (0x28) | ||
264 | #define HFA384x_SWSUPPORT0_OFF (0x50) | ||
265 | #define HFA384x_SWSUPPORT1_OFF (0x54) | ||
266 | #define HFA384x_SWSUPPORT2_OFF (0x58) | ||
267 | #define HFA384x_AUXPAGE_OFF (0x74) | ||
268 | #define HFA384x_AUXOFFSET_OFF (0x78) | ||
269 | #define HFA384x_AUXDATA_OFF (0x7c) | ||
270 | #define HFA384x_PCICOR_OFF (0x4c) | ||
271 | #define HFA384x_PCIHCR_OFF (0x5c) | ||
272 | #define HFA384x_PCI_M0_ADDRH_OFF (0x80) | ||
273 | #define HFA384x_PCI_M0_ADDRL_OFF (0x84) | ||
274 | #define HFA384x_PCI_M0_LEN_OFF (0x88) | ||
275 | #define HFA384x_PCI_M0_CTL_OFF (0x8c) | ||
276 | #define HFA384x_PCI_STATUS_OFF (0x98) | ||
277 | #define HFA384x_PCI_M1_ADDRH_OFF (0xa0) | ||
278 | #define HFA384x_PCI_M1_ADDRL_OFF (0xa4) | ||
279 | #define HFA384x_PCI_M1_LEN_OFF (0xa8) | ||
280 | #define HFA384x_PCI_M1_CTL_OFF (0xac) | ||
281 | |||
282 | #endif | ||
283 | |||
284 | /*--- Register Field Masks --------------------------*/ | ||
285 | #define HFA384x_CMD_BUSY ((UINT16)BIT15) | ||
286 | #define HFA384x_CMD_AINFO ((UINT16)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8)) | ||
287 | #define HFA384x_CMD_MACPORT ((UINT16)(BIT10 | BIT9 | BIT8)) | ||
288 | #define HFA384x_CMD_RECL ((UINT16)BIT8) | ||
289 | #define HFA384x_CMD_WRITE ((UINT16)BIT8) | ||
290 | #define HFA384x_CMD_PROGMODE ((UINT16)(BIT9 | BIT8)) | ||
291 | #define HFA384x_CMD_CMDCODE ((UINT16)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)) | ||
292 | |||
293 | #define HFA384x_STATUS_RESULT ((UINT16)(BIT14 | BIT13 | BIT12 | BIT11 | BIT10 | BIT9 | BIT8)) | ||
294 | #define HFA384x_STATUS_CMDCODE ((UINT16)(BIT5 | BIT4 | BIT3 | BIT2 | BIT1 | BIT0)) | ||
295 | |||
296 | #define HFA384x_OFFSET_BUSY ((UINT16)BIT15) | ||
297 | #define HFA384x_OFFSET_ERR ((UINT16)BIT14) | ||
298 | #define HFA384x_OFFSET_DATAOFF ((UINT16)(BIT11 | BIT10 | BIT9 | BIT8 | BIT7 | BIT6 | BIT5 | BIT4 | BIT3 | BIT2 | BIT1)) | ||
299 | |||
300 | #define HFA384x_EVSTAT_TICK ((UINT16)BIT15) | ||
301 | #define HFA384x_EVSTAT_WTERR ((UINT16)BIT14) | ||
302 | #define HFA384x_EVSTAT_INFDROP ((UINT16)BIT13) | ||
303 | #define HFA384x_EVSTAT_INFO ((UINT16)BIT7) | ||
304 | #define HFA384x_EVSTAT_DTIM ((UINT16)BIT5) | ||
305 | #define HFA384x_EVSTAT_CMD ((UINT16)BIT4) | ||
306 | #define HFA384x_EVSTAT_ALLOC ((UINT16)BIT3) | ||
307 | #define HFA384x_EVSTAT_TXEXC ((UINT16)BIT2) | ||
308 | #define HFA384x_EVSTAT_TX ((UINT16)BIT1) | ||
309 | #define HFA384x_EVSTAT_RX ((UINT16)BIT0) | ||
310 | |||
311 | #define HFA384x_INT_BAP_OP (HFA384x_EVSTAT_INFO|HFA384x_EVSTAT_RX|HFA384x_EVSTAT_TX|HFA384x_EVSTAT_TXEXC) | ||
312 | |||
313 | #define HFA384x_INT_NORMAL (HFA384x_EVSTAT_INFO|HFA384x_EVSTAT_RX|HFA384x_EVSTAT_TX|HFA384x_EVSTAT_TXEXC|HFA384x_EVSTAT_INFDROP|HFA384x_EVSTAT_ALLOC|HFA384x_EVSTAT_DTIM) | ||
314 | |||
315 | #define HFA384x_INTEN_TICK ((UINT16)BIT15) | ||
316 | #define HFA384x_INTEN_WTERR ((UINT16)BIT14) | ||
317 | #define HFA384x_INTEN_INFDROP ((UINT16)BIT13) | ||
318 | #define HFA384x_INTEN_INFO ((UINT16)BIT7) | ||
319 | #define HFA384x_INTEN_DTIM ((UINT16)BIT5) | ||
320 | #define HFA384x_INTEN_CMD ((UINT16)BIT4) | ||
321 | #define HFA384x_INTEN_ALLOC ((UINT16)BIT3) | ||
322 | #define HFA384x_INTEN_TXEXC ((UINT16)BIT2) | ||
323 | #define HFA384x_INTEN_TX ((UINT16)BIT1) | ||
324 | #define HFA384x_INTEN_RX ((UINT16)BIT0) | ||
325 | |||
326 | #define HFA384x_EVACK_TICK ((UINT16)BIT15) | ||
327 | #define HFA384x_EVACK_WTERR ((UINT16)BIT14) | ||
328 | #define HFA384x_EVACK_INFDROP ((UINT16)BIT13) | ||
329 | #define HFA384x_EVACK_INFO ((UINT16)BIT7) | ||
330 | #define HFA384x_EVACK_DTIM ((UINT16)BIT5) | ||
331 | #define HFA384x_EVACK_CMD ((UINT16)BIT4) | ||
332 | #define HFA384x_EVACK_ALLOC ((UINT16)BIT3) | ||
333 | #define HFA384x_EVACK_TXEXC ((UINT16)BIT2) | ||
334 | #define HFA384x_EVACK_TX ((UINT16)BIT1) | ||
335 | #define HFA384x_EVACK_RX ((UINT16)BIT0) | ||
336 | |||
337 | #define HFA384x_CONTROL_AUXEN ((UINT16)(BIT15 | BIT14)) | ||
338 | |||
339 | |||
340 | /*--- Command Code Constants --------------------------*/ | ||
341 | /*--- Controller Commands --------------------------*/ | ||
342 | #define HFA384x_CMDCODE_INIT ((UINT16)0x00) | ||
343 | #define HFA384x_CMDCODE_ENABLE ((UINT16)0x01) | ||
344 | #define HFA384x_CMDCODE_DISABLE ((UINT16)0x02) | ||
345 | #define HFA384x_CMDCODE_DIAG ((UINT16)0x03) | ||
346 | |||
347 | /*--- Buffer Mgmt Commands --------------------------*/ | ||
348 | #define HFA384x_CMDCODE_ALLOC ((UINT16)0x0A) | ||
349 | #define HFA384x_CMDCODE_TX ((UINT16)0x0B) | ||
350 | #define HFA384x_CMDCODE_CLRPRST ((UINT16)0x12) | ||
351 | |||
352 | /*--- Regulate Commands --------------------------*/ | ||
353 | #define HFA384x_CMDCODE_NOTIFY ((UINT16)0x10) | ||
354 | #define HFA384x_CMDCODE_INQ ((UINT16)0x11) | ||
355 | |||
356 | /*--- Configure Commands --------------------------*/ | ||
357 | #define HFA384x_CMDCODE_ACCESS ((UINT16)0x21) | ||
358 | #define HFA384x_CMDCODE_DOWNLD ((UINT16)0x22) | ||
359 | |||
360 | /*--- Debugging Commands -----------------------------*/ | ||
361 | #define HFA384x_CMDCODE_MONITOR ((UINT16)(0x38)) | ||
362 | #define HFA384x_MONITOR_ENABLE ((UINT16)(0x0b)) | ||
363 | #define HFA384x_MONITOR_DISABLE ((UINT16)(0x0f)) | ||
364 | |||
365 | /*--- Result Codes --------------------------*/ | ||
366 | #define HFA384x_SUCCESS ((UINT16)(0x00)) | ||
367 | #define HFA384x_CARD_FAIL ((UINT16)(0x01)) | ||
368 | #define HFA384x_NO_BUFF ((UINT16)(0x05)) | ||
369 | #define HFA384x_CMD_ERR ((UINT16)(0x7F)) | ||
370 | |||
371 | /*--- Programming Modes -------------------------- | ||
372 | MODE 0: Disable programming | ||
373 | MODE 1: Enable volatile memory programming | ||
374 | MODE 2: Enable non-volatile memory programming | ||
375 | MODE 3: Program non-volatile memory section | ||
376 | --------------------------------------------------*/ | ||
377 | #define HFA384x_PROGMODE_DISABLE ((UINT16)0x00) | ||
378 | #define HFA384x_PROGMODE_RAM ((UINT16)0x01) | ||
379 | #define HFA384x_PROGMODE_NV ((UINT16)0x02) | ||
380 | #define HFA384x_PROGMODE_NVWRITE ((UINT16)0x03) | ||
381 | |||
382 | /*--- AUX register enable --------------------------*/ | ||
383 | #define HFA384x_AUXPW0 ((UINT16)0xfe01) | ||
384 | #define HFA384x_AUXPW1 ((UINT16)0xdc23) | ||
385 | #define HFA384x_AUXPW2 ((UINT16)0xba45) | ||
386 | |||
387 | #define HFA384x_CONTROL_AUX_ISDISABLED ((UINT16)0x0000) | ||
388 | #define HFA384x_CONTROL_AUX_ISENABLED ((UINT16)0xc000) | ||
389 | #define HFA384x_CONTROL_AUX_DOENABLE ((UINT16)0x8000) | ||
390 | #define HFA384x_CONTROL_AUX_DODISABLE ((UINT16)0x4000) | ||
391 | |||
392 | /*--- Record ID Constants --------------------------*/ | ||
393 | /*-------------------------------------------------------------------- | ||
394 | Configuration RIDs: Network Parameters, Static Configuration Entities | ||
395 | --------------------------------------------------------------------*/ | ||
396 | #define HFA384x_RID_CNFPORTTYPE ((UINT16)0xFC00) | ||
397 | #define HFA384x_RID_CNFOWNMACADDR ((UINT16)0xFC01) | ||
398 | #define HFA384x_RID_CNFDESIREDSSID ((UINT16)0xFC02) | ||
399 | #define HFA384x_RID_CNFOWNCHANNEL ((UINT16)0xFC03) | ||
400 | #define HFA384x_RID_CNFOWNSSID ((UINT16)0xFC04) | ||
401 | #define HFA384x_RID_CNFOWNATIMWIN ((UINT16)0xFC05) | ||
402 | #define HFA384x_RID_CNFSYSSCALE ((UINT16)0xFC06) | ||
403 | #define HFA384x_RID_CNFMAXDATALEN ((UINT16)0xFC07) | ||
404 | #define HFA384x_RID_CNFWDSADDR ((UINT16)0xFC08) | ||
405 | #define HFA384x_RID_CNFPMENABLED ((UINT16)0xFC09) | ||
406 | #define HFA384x_RID_CNFPMEPS ((UINT16)0xFC0A) | ||
407 | #define HFA384x_RID_CNFMULTICASTRX ((UINT16)0xFC0B) | ||
408 | #define HFA384x_RID_CNFMAXSLEEPDUR ((UINT16)0xFC0C) | ||
409 | #define HFA384x_RID_CNFPMHOLDDUR ((UINT16)0xFC0D) | ||
410 | #define HFA384x_RID_CNFOWNNAME ((UINT16)0xFC0E) | ||
411 | #define HFA384x_RID_CNFOWNDTIMPER ((UINT16)0xFC10) | ||
412 | #define HFA384x_RID_CNFWDSADDR1 ((UINT16)0xFC11) | ||
413 | #define HFA384x_RID_CNFWDSADDR2 ((UINT16)0xFC12) | ||
414 | #define HFA384x_RID_CNFWDSADDR3 ((UINT16)0xFC13) | ||
415 | #define HFA384x_RID_CNFWDSADDR4 ((UINT16)0xFC14) | ||
416 | #define HFA384x_RID_CNFWDSADDR5 ((UINT16)0xFC15) | ||
417 | #define HFA384x_RID_CNFWDSADDR6 ((UINT16)0xFC16) | ||
418 | #define HFA384x_RID_CNFMCASTPMBUFF ((UINT16)0xFC17) | ||
419 | |||
420 | /*-------------------------------------------------------------------- | ||
421 | Configuration RID lengths: Network Params, Static Config Entities | ||
422 | This is the length of JUST the DATA part of the RID (does not | ||
423 | include the len or code fields) | ||
424 | --------------------------------------------------------------------*/ | ||
425 | /* TODO: fill in the rest of these */ | ||
426 | #define HFA384x_RID_CNFPORTTYPE_LEN ((UINT16)2) | ||
427 | #define HFA384x_RID_CNFOWNMACADDR_LEN ((UINT16)6) | ||
428 | #define HFA384x_RID_CNFDESIREDSSID_LEN ((UINT16)34) | ||
429 | #define HFA384x_RID_CNFOWNCHANNEL_LEN ((UINT16)2) | ||
430 | #define HFA384x_RID_CNFOWNSSID_LEN ((UINT16)34) | ||
431 | #define HFA384x_RID_CNFOWNATIMWIN_LEN ((UINT16)2) | ||
432 | #define HFA384x_RID_CNFSYSSCALE_LEN ((UINT16)0) | ||
433 | #define HFA384x_RID_CNFMAXDATALEN_LEN ((UINT16)0) | ||
434 | #define HFA384x_RID_CNFWDSADDR_LEN ((UINT16)6) | ||
435 | #define HFA384x_RID_CNFPMENABLED_LEN ((UINT16)0) | ||
436 | #define HFA384x_RID_CNFPMEPS_LEN ((UINT16)0) | ||
437 | #define HFA384x_RID_CNFMULTICASTRX_LEN ((UINT16)0) | ||
438 | #define HFA384x_RID_CNFMAXSLEEPDUR_LEN ((UINT16)0) | ||
439 | #define HFA384x_RID_CNFPMHOLDDUR_LEN ((UINT16)0) | ||
440 | #define HFA384x_RID_CNFOWNNAME_LEN ((UINT16)34) | ||
441 | #define HFA384x_RID_CNFOWNDTIMPER_LEN ((UINT16)0) | ||
442 | #define HFA384x_RID_CNFWDSADDR1_LEN ((UINT16)6) | ||
443 | #define HFA384x_RID_CNFWDSADDR2_LEN ((UINT16)6) | ||
444 | #define HFA384x_RID_CNFWDSADDR3_LEN ((UINT16)6) | ||
445 | #define HFA384x_RID_CNFWDSADDR4_LEN ((UINT16)6) | ||
446 | #define HFA384x_RID_CNFWDSADDR5_LEN ((UINT16)6) | ||
447 | #define HFA384x_RID_CNFWDSADDR6_LEN ((UINT16)6) | ||
448 | #define HFA384x_RID_CNFMCASTPMBUFF_LEN ((UINT16)0) | ||
449 | #define HFA384x_RID_CNFAUTHENTICATION_LEN ((UINT16)sizeof(UINT16)) | ||
450 | #define HFA384x_RID_CNFMAXSLEEPDUR_LEN ((UINT16)0) | ||
451 | |||
452 | /*-------------------------------------------------------------------- | ||
453 | Configuration RIDs: Network Parameters, Dynamic Configuration Entities | ||
454 | --------------------------------------------------------------------*/ | ||
455 | #define HFA384x_RID_GROUPADDR ((UINT16)0xFC80) | ||
456 | #define HFA384x_RID_CREATEIBSS ((UINT16)0xFC81) | ||
457 | #define HFA384x_RID_FRAGTHRESH ((UINT16)0xFC82) | ||
458 | #define HFA384x_RID_RTSTHRESH ((UINT16)0xFC83) | ||
459 | #define HFA384x_RID_TXRATECNTL ((UINT16)0xFC84) | ||
460 | #define HFA384x_RID_PROMISCMODE ((UINT16)0xFC85) | ||
461 | #define HFA384x_RID_FRAGTHRESH0 ((UINT16)0xFC90) | ||
462 | #define HFA384x_RID_FRAGTHRESH1 ((UINT16)0xFC91) | ||
463 | #define HFA384x_RID_FRAGTHRESH2 ((UINT16)0xFC92) | ||
464 | #define HFA384x_RID_FRAGTHRESH3 ((UINT16)0xFC93) | ||
465 | #define HFA384x_RID_FRAGTHRESH4 ((UINT16)0xFC94) | ||
466 | #define HFA384x_RID_FRAGTHRESH5 ((UINT16)0xFC95) | ||
467 | #define HFA384x_RID_FRAGTHRESH6 ((UINT16)0xFC96) | ||
468 | #define HFA384x_RID_RTSTHRESH0 ((UINT16)0xFC97) | ||
469 | #define HFA384x_RID_RTSTHRESH1 ((UINT16)0xFC98) | ||
470 | #define HFA384x_RID_RTSTHRESH2 ((UINT16)0xFC99) | ||
471 | #define HFA384x_RID_RTSTHRESH3 ((UINT16)0xFC9A) | ||
472 | #define HFA384x_RID_RTSTHRESH4 ((UINT16)0xFC9B) | ||
473 | #define HFA384x_RID_RTSTHRESH5 ((UINT16)0xFC9C) | ||
474 | #define HFA384x_RID_RTSTHRESH6 ((UINT16)0xFC9D) | ||
475 | #define HFA384x_RID_TXRATECNTL0 ((UINT16)0xFC9E) | ||
476 | #define HFA384x_RID_TXRATECNTL1 ((UINT16)0xFC9F) | ||
477 | #define HFA384x_RID_TXRATECNTL2 ((UINT16)0xFCA0) | ||
478 | #define HFA384x_RID_TXRATECNTL3 ((UINT16)0xFCA1) | ||
479 | #define HFA384x_RID_TXRATECNTL4 ((UINT16)0xFCA2) | ||
480 | #define HFA384x_RID_TXRATECNTL5 ((UINT16)0xFCA3) | ||
481 | #define HFA384x_RID_TXRATECNTL6 ((UINT16)0xFCA4) | ||
482 | |||
483 | /*-------------------------------------------------------------------- | ||
484 | Configuration RID Lengths: Network Param, Dynamic Config Entities | ||
485 | This is the length of JUST the DATA part of the RID (does not | ||
486 | include the len or code fields) | ||
487 | --------------------------------------------------------------------*/ | ||
488 | /* TODO: fill in the rest of these */ | ||
489 | #define HFA384x_RID_GROUPADDR_LEN ((UINT16)16 * WLAN_ADDR_LEN) | ||
490 | #define HFA384x_RID_CREATEIBSS_LEN ((UINT16)0) | ||
491 | #define HFA384x_RID_FRAGTHRESH_LEN ((UINT16)0) | ||
492 | #define HFA384x_RID_RTSTHRESH_LEN ((UINT16)0) | ||
493 | #define HFA384x_RID_TXRATECNTL_LEN ((UINT16)4) | ||
494 | #define HFA384x_RID_PROMISCMODE_LEN ((UINT16)2) | ||
495 | #define HFA384x_RID_FRAGTHRESH0_LEN ((UINT16)0) | ||
496 | #define HFA384x_RID_FRAGTHRESH1_LEN ((UINT16)0) | ||
497 | #define HFA384x_RID_FRAGTHRESH2_LEN ((UINT16)0) | ||
498 | #define HFA384x_RID_FRAGTHRESH3_LEN ((UINT16)0) | ||
499 | #define HFA384x_RID_FRAGTHRESH4_LEN ((UINT16)0) | ||
500 | #define HFA384x_RID_FRAGTHRESH5_LEN ((UINT16)0) | ||
501 | #define HFA384x_RID_FRAGTHRESH6_LEN ((UINT16)0) | ||
502 | #define HFA384x_RID_RTSTHRESH0_LEN ((UINT16)0) | ||
503 | #define HFA384x_RID_RTSTHRESH1_LEN ((UINT16)0) | ||
504 | #define HFA384x_RID_RTSTHRESH2_LEN ((UINT16)0) | ||
505 | #define HFA384x_RID_RTSTHRESH3_LEN ((UINT16)0) | ||
506 | #define HFA384x_RID_RTSTHRESH4_LEN ((UINT16)0) | ||
507 | #define HFA384x_RID_RTSTHRESH5_LEN ((UINT16)0) | ||
508 | #define HFA384x_RID_RTSTHRESH6_LEN ((UINT16)0) | ||
509 | #define HFA384x_RID_TXRATECNTL0_LEN ((UINT16)0) | ||
510 | #define HFA384x_RID_TXRATECNTL1_LEN ((UINT16)0) | ||
511 | #define HFA384x_RID_TXRATECNTL2_LEN ((UINT16)0) | ||
512 | #define HFA384x_RID_TXRATECNTL3_LEN ((UINT16)0) | ||
513 | #define HFA384x_RID_TXRATECNTL4_LEN ((UINT16)0) | ||
514 | #define HFA384x_RID_TXRATECNTL5_LEN ((UINT16)0) | ||
515 | #define HFA384x_RID_TXRATECNTL6_LEN ((UINT16)0) | ||
516 | |||
517 | /*-------------------------------------------------------------------- | ||
518 | Configuration RIDs: Behavior Parameters | ||
519 | --------------------------------------------------------------------*/ | ||
520 | #define HFA384x_RID_ITICKTIME ((UINT16)0xFCE0) | ||
521 | |||
522 | /*-------------------------------------------------------------------- | ||
523 | Configuration RID Lengths: Behavior Parameters | ||
524 | This is the length of JUST the DATA part of the RID (does not | ||
525 | include the len or code fields) | ||
526 | --------------------------------------------------------------------*/ | ||
527 | #define HFA384x_RID_ITICKTIME_LEN ((UINT16)2) | ||
528 | |||
529 | /*---------------------------------------------------------------------- | ||
530 | Information RIDs: NIC Information | ||
531 | --------------------------------------------------------------------*/ | ||
532 | #define HFA384x_RID_MAXLOADTIME ((UINT16)0xFD00) | ||
533 | #define HFA384x_RID_DOWNLOADBUFFER ((UINT16)0xFD01) | ||
534 | #define HFA384x_RID_PRIIDENTITY ((UINT16)0xFD02) | ||
535 | #define HFA384x_RID_PRISUPRANGE ((UINT16)0xFD03) | ||
536 | #define HFA384x_RID_PRI_CFIACTRANGES ((UINT16)0xFD04) | ||
537 | #define HFA384x_RID_NICSERIALNUMBER ((UINT16)0xFD0A) | ||
538 | #define HFA384x_RID_NICIDENTITY ((UINT16)0xFD0B) | ||
539 | #define HFA384x_RID_MFISUPRANGE ((UINT16)0xFD0C) | ||
540 | #define HFA384x_RID_CFISUPRANGE ((UINT16)0xFD0D) | ||
541 | #define HFA384x_RID_CHANNELLIST ((UINT16)0xFD10) | ||
542 | #define HFA384x_RID_REGULATORYDOMAINS ((UINT16)0xFD11) | ||
543 | #define HFA384x_RID_TEMPTYPE ((UINT16)0xFD12) | ||
544 | #define HFA384x_RID_CIS ((UINT16)0xFD13) | ||
545 | #define HFA384x_RID_STAIDENTITY ((UINT16)0xFD20) | ||
546 | #define HFA384x_RID_STASUPRANGE ((UINT16)0xFD21) | ||
547 | #define HFA384x_RID_STA_MFIACTRANGES ((UINT16)0xFD22) | ||
548 | #define HFA384x_RID_STA_CFIACTRANGES ((UINT16)0xFD23) | ||
549 | #define HFA384x_RID_BUILDSEQ ((UINT16)0xFFFE) | ||
550 | #define HFA384x_RID_FWID ((UINT16)0xFFFF) | ||
551 | |||
552 | /*---------------------------------------------------------------------- | ||
553 | Information RID Lengths: NIC Information | ||
554 | This is the length of JUST the DATA part of the RID (does not | ||
555 | include the len or code fields) | ||
556 | --------------------------------------------------------------------*/ | ||
557 | #define HFA384x_RID_MAXLOADTIME_LEN ((UINT16)0) | ||
558 | #define HFA384x_RID_DOWNLOADBUFFER_LEN ((UINT16)sizeof(hfa384x_downloadbuffer_t)) | ||
559 | #define HFA384x_RID_PRIIDENTITY_LEN ((UINT16)8) | ||
560 | #define HFA384x_RID_PRISUPRANGE_LEN ((UINT16)10) | ||
561 | #define HFA384x_RID_CFIACTRANGES_LEN ((UINT16)10) | ||
562 | #define HFA384x_RID_NICSERIALNUMBER_LEN ((UINT16)12) | ||
563 | #define HFA384x_RID_NICIDENTITY_LEN ((UINT16)8) | ||
564 | #define HFA384x_RID_MFISUPRANGE_LEN ((UINT16)10) | ||
565 | #define HFA384x_RID_CFISUPRANGE_LEN ((UINT16)10) | ||
566 | #define HFA384x_RID_CHANNELLIST_LEN ((UINT16)0) | ||
567 | #define HFA384x_RID_REGULATORYDOMAINS_LEN ((UINT16)12) | ||
568 | #define HFA384x_RID_TEMPTYPE_LEN ((UINT16)0) | ||
569 | #define HFA384x_RID_CIS_LEN ((UINT16)480) | ||
570 | #define HFA384x_RID_STAIDENTITY_LEN ((UINT16)8) | ||
571 | #define HFA384x_RID_STASUPRANGE_LEN ((UINT16)10) | ||
572 | #define HFA384x_RID_MFIACTRANGES_LEN ((UINT16)10) | ||
573 | #define HFA384x_RID_CFIACTRANGES2_LEN ((UINT16)10) | ||
574 | #define HFA384x_RID_BUILDSEQ_LEN ((UINT16)sizeof(hfa384x_BuildSeq_t)) | ||
575 | #define HFA384x_RID_FWID_LEN ((UINT16)sizeof(hfa384x_FWID_t)) | ||
576 | |||
577 | /*-------------------------------------------------------------------- | ||
578 | Information RIDs: MAC Information | ||
579 | --------------------------------------------------------------------*/ | ||
580 | #define HFA384x_RID_PORTSTATUS ((UINT16)0xFD40) | ||
581 | #define HFA384x_RID_CURRENTSSID ((UINT16)0xFD41) | ||
582 | #define HFA384x_RID_CURRENTBSSID ((UINT16)0xFD42) | ||
583 | #define HFA384x_RID_COMMSQUALITY ((UINT16)0xFD43) | ||
584 | #define HFA384x_RID_CURRENTTXRATE ((UINT16)0xFD44) | ||
585 | #define HFA384x_RID_CURRENTBCNINT ((UINT16)0xFD45) | ||
586 | #define HFA384x_RID_CURRENTSCALETHRESH ((UINT16)0xFD46) | ||
587 | #define HFA384x_RID_PROTOCOLRSPTIME ((UINT16)0xFD47) | ||
588 | #define HFA384x_RID_SHORTRETRYLIMIT ((UINT16)0xFD48) | ||
589 | #define HFA384x_RID_LONGRETRYLIMIT ((UINT16)0xFD49) | ||
590 | #define HFA384x_RID_MAXTXLIFETIME ((UINT16)0xFD4A) | ||
591 | #define HFA384x_RID_MAXRXLIFETIME ((UINT16)0xFD4B) | ||
592 | #define HFA384x_RID_CFPOLLABLE ((UINT16)0xFD4C) | ||
593 | #define HFA384x_RID_AUTHALGORITHMS ((UINT16)0xFD4D) | ||
594 | #define HFA384x_RID_PRIVACYOPTIMP ((UINT16)0xFD4F) | ||
595 | #define HFA384x_RID_DBMCOMMSQUALITY ((UINT16)0xFD51) | ||
596 | #define HFA384x_RID_CURRENTTXRATE1 ((UINT16)0xFD80) | ||
597 | #define HFA384x_RID_CURRENTTXRATE2 ((UINT16)0xFD81) | ||
598 | #define HFA384x_RID_CURRENTTXRATE3 ((UINT16)0xFD82) | ||
599 | #define HFA384x_RID_CURRENTTXRATE4 ((UINT16)0xFD83) | ||
600 | #define HFA384x_RID_CURRENTTXRATE5 ((UINT16)0xFD84) | ||
601 | #define HFA384x_RID_CURRENTTXRATE6 ((UINT16)0xFD85) | ||
602 | #define HFA384x_RID_OWNMACADDRESS ((UINT16)0xFD86) | ||
603 | // #define HFA384x_RID_PCFINFO ((UINT16)0xFD87) | ||
604 | #define HFA384x_RID_SCANRESULTS ((UINT16)0xFD88) // NEW | ||
605 | #define HFA384x_RID_HOSTSCANRESULTS ((UINT16)0xFD89) // NEW | ||
606 | #define HFA384x_RID_AUTHENTICATIONUSED ((UINT16)0xFD8A) // NEW | ||
607 | #define HFA384x_RID_ASSOCIATEFAILURE ((UINT16)0xFD8D) // 1.8.0 | ||
608 | |||
609 | /*-------------------------------------------------------------------- | ||
610 | Information RID Lengths: MAC Information | ||
611 | This is the length of JUST the DATA part of the RID (does not | ||
612 | include the len or code fields) | ||
613 | --------------------------------------------------------------------*/ | ||
614 | #define HFA384x_RID_PORTSTATUS_LEN ((UINT16)0) | ||
615 | #define HFA384x_RID_CURRENTSSID_LEN ((UINT16)34) | ||
616 | #define HFA384x_RID_CURRENTBSSID_LEN ((UINT16)WLAN_BSSID_LEN) | ||
617 | #define HFA384x_RID_COMMSQUALITY_LEN ((UINT16)sizeof(hfa384x_commsquality_t)) | ||
618 | #define HFA384x_RID_DBMCOMMSQUALITY_LEN ((UINT16)sizeof(hfa384x_dbmcommsquality_t)) | ||
619 | #define HFA384x_RID_CURRENTTXRATE_LEN ((UINT16)0) | ||
620 | #define HFA384x_RID_CURRENTBCNINT_LEN ((UINT16)0) | ||
621 | #define HFA384x_RID_STACURSCALETHRESH_LEN ((UINT16)12) | ||
622 | #define HFA384x_RID_APCURSCALETHRESH_LEN ((UINT16)6) | ||
623 | #define HFA384x_RID_PROTOCOLRSPTIME_LEN ((UINT16)0) | ||
624 | #define HFA384x_RID_SHORTRETRYLIMIT_LEN ((UINT16)0) | ||
625 | #define HFA384x_RID_LONGRETRYLIMIT_LEN ((UINT16)0) | ||
626 | #define HFA384x_RID_MAXTXLIFETIME_LEN ((UINT16)0) | ||
627 | #define HFA384x_RID_MAXRXLIFETIME_LEN ((UINT16)0) | ||
628 | #define HFA384x_RID_CFPOLLABLE_LEN ((UINT16)0) | ||
629 | #define HFA384x_RID_AUTHALGORITHMS_LEN ((UINT16)4) | ||
630 | #define HFA384x_RID_PRIVACYOPTIMP_LEN ((UINT16)0) | ||
631 | #define HFA384x_RID_CURRENTTXRATE1_LEN ((UINT16)0) | ||
632 | #define HFA384x_RID_CURRENTTXRATE2_LEN ((UINT16)0) | ||
633 | #define HFA384x_RID_CURRENTTXRATE3_LEN ((UINT16)0) | ||
634 | #define HFA384x_RID_CURRENTTXRATE4_LEN ((UINT16)0) | ||
635 | #define HFA384x_RID_CURRENTTXRATE5_LEN ((UINT16)0) | ||
636 | #define HFA384x_RID_CURRENTTXRATE6_LEN ((UINT16)0) | ||
637 | #define HFA384x_RID_OWNMACADDRESS_LEN ((UINT16)6) | ||
638 | #define HFA384x_RID_PCFINFO_LEN ((UINT16)6) | ||
639 | #define HFA384x_RID_CNFAPPCFINFO_LEN ((UINT16)sizeof(hfa384x_PCFInfo_data_t)) | ||
640 | #define HFA384x_RID_SCANREQUEST_LEN ((UINT16)sizeof(hfa384x_ScanRequest_data_t)) | ||
641 | #define HFA384x_RID_JOINREQUEST_LEN ((UINT16)sizeof(hfa384x_JoinRequest_data_t)) | ||
642 | #define HFA384x_RID_AUTHENTICATESTA_LEN ((UINT16)sizeof(hfa384x_authenticateStation_data_t)) | ||
643 | #define HFA384x_RID_CHANNELINFOREQUEST_LEN ((UINT16)sizeof(hfa384x_ChannelInfoRequest_data_t)) | ||
644 | /*-------------------------------------------------------------------- | ||
645 | Information RIDs: Modem Information | ||
646 | --------------------------------------------------------------------*/ | ||
647 | #define HFA384x_RID_PHYTYPE ((UINT16)0xFDC0) | ||
648 | #define HFA384x_RID_CURRENTCHANNEL ((UINT16)0xFDC1) | ||
649 | #define HFA384x_RID_CURRENTPOWERSTATE ((UINT16)0xFDC2) | ||
650 | #define HFA384x_RID_CCAMODE ((UINT16)0xFDC3) | ||
651 | #define HFA384x_RID_SUPPORTEDDATARATES ((UINT16)0xFDC6) | ||
652 | #define HFA384x_RID_LFOSTATUS ((UINT16)0xFDC7) // 1.7.1 | ||
653 | |||
654 | /*-------------------------------------------------------------------- | ||
655 | Information RID Lengths: Modem Information | ||
656 | This is the length of JUST the DATA part of the RID (does not | ||
657 | include the len or code fields) | ||
658 | --------------------------------------------------------------------*/ | ||
659 | #define HFA384x_RID_PHYTYPE_LEN ((UINT16)0) | ||
660 | #define HFA384x_RID_CURRENTCHANNEL_LEN ((UINT16)0) | ||
661 | #define HFA384x_RID_CURRENTPOWERSTATE_LEN ((UINT16)0) | ||
662 | #define HFA384x_RID_CCAMODE_LEN ((UINT16)0) | ||
663 | #define HFA384x_RID_SUPPORTEDDATARATES_LEN ((UINT16)10) | ||
664 | |||
665 | /*-------------------------------------------------------------------- | ||
666 | API ENHANCEMENTS (NOT ALREADY IMPLEMENTED) | ||
667 | --------------------------------------------------------------------*/ | ||
668 | #define HFA384x_RID_CNFWEPDEFAULTKEYID ((UINT16)0xFC23) | ||
669 | #define HFA384x_RID_CNFWEPDEFAULTKEY0 ((UINT16)0xFC24) | ||
670 | #define HFA384x_RID_CNFWEPDEFAULTKEY1 ((UINT16)0xFC25) | ||
671 | #define HFA384x_RID_CNFWEPDEFAULTKEY2 ((UINT16)0xFC26) | ||
672 | #define HFA384x_RID_CNFWEPDEFAULTKEY3 ((UINT16)0xFC27) | ||
673 | #define HFA384x_RID_CNFWEPFLAGS ((UINT16)0xFC28) | ||
674 | #define HFA384x_RID_CNFWEPKEYMAPTABLE ((UINT16)0xFC29) | ||
675 | #define HFA384x_RID_CNFAUTHENTICATION ((UINT16)0xFC2A) | ||
676 | #define HFA384x_RID_CNFMAXASSOCSTATIONS ((UINT16)0xFC2B) | ||
677 | #define HFA384x_RID_CNFTXCONTROL ((UINT16)0xFC2C) | ||
678 | #define HFA384x_RID_CNFROAMINGMODE ((UINT16)0xFC2D) | ||
679 | #define HFA384x_RID_CNFHOSTAUTHASSOC ((UINT16)0xFC2E) | ||
680 | #define HFA384x_RID_CNFRCVCRCERROR ((UINT16)0xFC30) | ||
681 | // #define HFA384x_RID_CNFMMLIFE ((UINT16)0xFC31) | ||
682 | #define HFA384x_RID_CNFALTRETRYCNT ((UINT16)0xFC32) | ||
683 | #define HFA384x_RID_CNFAPBCNINT ((UINT16)0xFC33) | ||
684 | #define HFA384x_RID_CNFAPPCFINFO ((UINT16)0xFC34) | ||
685 | #define HFA384x_RID_CNFSTAPCFINFO ((UINT16)0xFC35) | ||
686 | #define HFA384x_RID_CNFPRIORITYQUSAGE ((UINT16)0xFC37) | ||
687 | #define HFA384x_RID_CNFTIMCTRL ((UINT16)0xFC40) | ||
688 | #define HFA384x_RID_CNFTHIRTY2TALLY ((UINT16)0xFC42) | ||
689 | #define HFA384x_RID_CNFENHSECURITY ((UINT16)0xFC43) | ||
690 | #define HFA384x_RID_CNFDBMADJUST ((UINT16)0xFC46) // NEW | ||
691 | #define HFA384x_RID_CNFWPADATA ((UINT16)0xFC48) // 1.7.0 | ||
692 | #define HFA384x_RID_CNFPROPOGATIONDELAY ((UINT16)0xFC49) // 1.7.6 | ||
693 | #define HFA384x_RID_CNFSHORTPREAMBLE ((UINT16)0xFCB0) | ||
694 | #define HFA384x_RID_CNFEXCLONGPREAMBLE ((UINT16)0xFCB1) | ||
695 | #define HFA384x_RID_CNFAUTHRSPTIMEOUT ((UINT16)0xFCB2) | ||
696 | #define HFA384x_RID_CNFBASICRATES ((UINT16)0xFCB3) | ||
697 | #define HFA384x_RID_CNFSUPPRATES ((UINT16)0xFCB4) | ||
698 | #define HFA384x_RID_CNFFALLBACKCTRL ((UINT16)0xFCB5) // NEW | ||
699 | #define HFA384x_RID_WEPKEYSTATUS ((UINT16)0xFCB6) // NEW | ||
700 | #define HFA384x_RID_WEPKEYMAPINDEX ((UINT16)0xFCB7) // NEW | ||
701 | #define HFA384x_RID_BROADCASTKEYID ((UINT16)0xFCB8) // NEW | ||
702 | #define HFA384x_RID_ENTSECFLAGEYID ((UINT16)0xFCB9) // NEW | ||
703 | #define HFA384x_RID_CNFPASSIVESCANCTRL ((UINT16)0xFCBA) // NEW STA | ||
704 | #define HFA384x_RID_CNFWPAHANDLING ((UINT16)0xFCBB) // 1.7.0 | ||
705 | #define HFA384x_RID_MDCCONTROL ((UINT16)0xFCBC) // 1.7.0/1.4.0 | ||
706 | #define HFA384x_RID_MDCCOUNTRY ((UINT16)0xFCBD) // 1.7.0/1.4.0 | ||
707 | #define HFA384x_RID_TXPOWERMAX ((UINT16)0xFCBE) // 1.7.0/1.4.0 | ||
708 | #define HFA384x_RID_CNFLFOENBLED ((UINT16)0xFCBF) // 1.6.3 | ||
709 | #define HFA384x_RID_CAPINFO ((UINT16)0xFCC0) // 1.7.0/1.3.7 | ||
710 | #define HFA384x_RID_LISTENINTERVAL ((UINT16)0xFCC1) // 1.7.0/1.3.7 | ||
711 | #define HFA384x_RID_DIVERSITYENABLED ((UINT16)0xFCC2) // 1.7.0/1.3.7 | ||
712 | #define HFA384x_RID_LED_CONTROL ((UINT16)0xFCC4) // 1.7.6 | ||
713 | #define HFA384x_RID_HFO_DELAY ((UINT16)0xFCC5) // 1.7.6 | ||
714 | #define HFA384x_RID_DISSALOWEDBSSID ((UINT16)0xFCC6) // 1.8.0 | ||
715 | #define HFA384x_RID_SCANREQUEST ((UINT16)0xFCE1) | ||
716 | #define HFA384x_RID_JOINREQUEST ((UINT16)0xFCE2) | ||
717 | #define HFA384x_RID_AUTHENTICATESTA ((UINT16)0xFCE3) | ||
718 | #define HFA384x_RID_CHANNELINFOREQUEST ((UINT16)0xFCE4) | ||
719 | #define HFA384x_RID_HOSTSCAN ((UINT16)0xFCE5) // NEW STA | ||
720 | #define HFA384x_RID_ASSOCIATESTA ((UINT16)0xFCE6) | ||
721 | |||
722 | #define HFA384x_RID_CNFWEPDEFAULTKEY_LEN ((UINT16)6) | ||
723 | #define HFA384x_RID_CNFWEP128DEFAULTKEY_LEN ((UINT16)14) | ||
724 | #define HFA384x_RID_CNFPRIOQUSAGE_LEN ((UINT16)4) | ||
725 | /*-------------------------------------------------------------------- | ||
726 | PD Record codes | ||
727 | --------------------------------------------------------------------*/ | ||
728 | #define HFA384x_PDR_PCB_PARTNUM ((UINT16)0x0001) | ||
729 | #define HFA384x_PDR_PDAVER ((UINT16)0x0002) | ||
730 | #define HFA384x_PDR_NIC_SERIAL ((UINT16)0x0003) | ||
731 | #define HFA384x_PDR_MKK_MEASUREMENTS ((UINT16)0x0004) | ||
732 | #define HFA384x_PDR_NIC_RAMSIZE ((UINT16)0x0005) | ||
733 | #define HFA384x_PDR_MFISUPRANGE ((UINT16)0x0006) | ||
734 | #define HFA384x_PDR_CFISUPRANGE ((UINT16)0x0007) | ||
735 | #define HFA384x_PDR_NICID ((UINT16)0x0008) | ||
736 | //#define HFA384x_PDR_REFDAC_MEASUREMENTS ((UINT16)0x0010) | ||
737 | //#define HFA384x_PDR_VGDAC_MEASUREMENTS ((UINT16)0x0020) | ||
738 | //#define HFA384x_PDR_LEVEL_COMP_MEASUREMENTS ((UINT16)0x0030) | ||
739 | //#define HFA384x_PDR_MODEM_TRIMDAC_MEASUREMENTS ((UINT16)0x0040) | ||
740 | //#define HFA384x_PDR_COREGA_HACK ((UINT16)0x00ff) | ||
741 | #define HFA384x_PDR_MAC_ADDRESS ((UINT16)0x0101) | ||
742 | //#define HFA384x_PDR_MKK_CALLNAME ((UINT16)0x0102) | ||
743 | #define HFA384x_PDR_REGDOMAIN ((UINT16)0x0103) | ||
744 | #define HFA384x_PDR_ALLOWED_CHANNEL ((UINT16)0x0104) | ||
745 | #define HFA384x_PDR_DEFAULT_CHANNEL ((UINT16)0x0105) | ||
746 | //#define HFA384x_PDR_PRIVACY_OPTION ((UINT16)0x0106) | ||
747 | #define HFA384x_PDR_TEMPTYPE ((UINT16)0x0107) | ||
748 | //#define HFA384x_PDR_REFDAC_SETUP ((UINT16)0x0110) | ||
749 | //#define HFA384x_PDR_VGDAC_SETUP ((UINT16)0x0120) | ||
750 | //#define HFA384x_PDR_LEVEL_COMP_SETUP ((UINT16)0x0130) | ||
751 | //#define HFA384x_PDR_TRIMDAC_SETUP ((UINT16)0x0140) | ||
752 | #define HFA384x_PDR_IFR_SETTING ((UINT16)0x0200) | ||
753 | #define HFA384x_PDR_RFR_SETTING ((UINT16)0x0201) | ||
754 | #define HFA384x_PDR_HFA3861_BASELINE ((UINT16)0x0202) | ||
755 | #define HFA384x_PDR_HFA3861_SHADOW ((UINT16)0x0203) | ||
756 | #define HFA384x_PDR_HFA3861_IFRF ((UINT16)0x0204) | ||
757 | #define HFA384x_PDR_HFA3861_CHCALSP ((UINT16)0x0300) | ||
758 | #define HFA384x_PDR_HFA3861_CHCALI ((UINT16)0x0301) | ||
759 | #define HFA384x_PDR_MAX_TX_POWER ((UINT16)0x0302) | ||
760 | #define HFA384x_PDR_MASTER_CHAN_LIST ((UINT16)0x0303) | ||
761 | #define HFA384x_PDR_3842_NIC_CONFIG ((UINT16)0x0400) | ||
762 | #define HFA384x_PDR_USB_ID ((UINT16)0x0401) | ||
763 | #define HFA384x_PDR_PCI_ID ((UINT16)0x0402) | ||
764 | #define HFA384x_PDR_PCI_IFCONF ((UINT16)0x0403) | ||
765 | #define HFA384x_PDR_PCI_PMCONF ((UINT16)0x0404) | ||
766 | #define HFA384x_PDR_RFENRGY ((UINT16)0x0406) | ||
767 | #define HFA384x_PDR_USB_POWER_TYPE ((UINT16)0x0407) | ||
768 | //#define HFA384x_PDR_UNKNOWN408 ((UINT16)0x0408) | ||
769 | #define HFA384x_PDR_USB_MAX_POWER ((UINT16)0x0409) | ||
770 | #define HFA384x_PDR_USB_MANUFACTURER ((UINT16)0x0410) | ||
771 | #define HFA384x_PDR_USB_PRODUCT ((UINT16)0x0411) | ||
772 | #define HFA384x_PDR_ANT_DIVERSITY ((UINT16)0x0412) | ||
773 | #define HFA384x_PDR_HFO_DELAY ((UINT16)0x0413) | ||
774 | #define HFA384x_PDR_SCALE_THRESH ((UINT16)0x0414) | ||
775 | |||
776 | #define HFA384x_PDR_HFA3861_MANF_TESTSP ((UINT16)0x0900) | ||
777 | #define HFA384x_PDR_HFA3861_MANF_TESTI ((UINT16)0x0901) | ||
778 | #define HFA384x_PDR_END_OF_PDA ((UINT16)0x0000) | ||
779 | |||
780 | |||
781 | /*=============================================================*/ | ||
782 | /*------ Macros -----------------------------------------------*/ | ||
783 | |||
784 | /*--- Register ID macros ------------------------*/ | ||
785 | |||
786 | #define HFA384x_CMD HFA384x_CMD_OFF | ||
787 | #define HFA384x_PARAM0 HFA384x_PARAM0_OFF | ||
788 | #define HFA384x_PARAM1 HFA384x_PARAM1_OFF | ||
789 | #define HFA384x_PARAM2 HFA384x_PARAM2_OFF | ||
790 | #define HFA384x_STATUS HFA384x_STATUS_OFF | ||
791 | #define HFA384x_RESP0 HFA384x_RESP0_OFF | ||
792 | #define HFA384x_RESP1 HFA384x_RESP1_OFF | ||
793 | #define HFA384x_RESP2 HFA384x_RESP2_OFF | ||
794 | #define HFA384x_INFOFID HFA384x_INFOFID_OFF | ||
795 | #define HFA384x_RXFID HFA384x_RXFID_OFF | ||
796 | #define HFA384x_ALLOCFID HFA384x_ALLOCFID_OFF | ||
797 | #define HFA384x_TXCOMPLFID HFA384x_TXCOMPLFID_OFF | ||
798 | #define HFA384x_SELECT0 HFA384x_SELECT0_OFF | ||
799 | #define HFA384x_OFFSET0 HFA384x_OFFSET0_OFF | ||
800 | #define HFA384x_DATA0 HFA384x_DATA0_OFF | ||
801 | #define HFA384x_SELECT1 HFA384x_SELECT1_OFF | ||
802 | #define HFA384x_OFFSET1 HFA384x_OFFSET1_OFF | ||
803 | #define HFA384x_DATA1 HFA384x_DATA1_OFF | ||
804 | #define HFA384x_EVSTAT HFA384x_EVSTAT_OFF | ||
805 | #define HFA384x_INTEN HFA384x_INTEN_OFF | ||
806 | #define HFA384x_EVACK HFA384x_EVACK_OFF | ||
807 | #define HFA384x_CONTROL HFA384x_CONTROL_OFF | ||
808 | #define HFA384x_SWSUPPORT0 HFA384x_SWSUPPORT0_OFF | ||
809 | #define HFA384x_SWSUPPORT1 HFA384x_SWSUPPORT1_OFF | ||
810 | #define HFA384x_SWSUPPORT2 HFA384x_SWSUPPORT2_OFF | ||
811 | #define HFA384x_AUXPAGE HFA384x_AUXPAGE_OFF | ||
812 | #define HFA384x_AUXOFFSET HFA384x_AUXOFFSET_OFF | ||
813 | #define HFA384x_AUXDATA HFA384x_AUXDATA_OFF | ||
814 | #define HFA384x_PCICOR HFA384x_PCICOR_OFF | ||
815 | #define HFA384x_PCIHCR HFA384x_PCIHCR_OFF | ||
816 | |||
817 | |||
818 | /*--- Register Test/Get/Set Field macros ------------------------*/ | ||
819 | |||
820 | #define HFA384x_CMD_ISBUSY(value) ((UINT16)(((UINT16)value) & HFA384x_CMD_BUSY)) | ||
821 | #define HFA384x_CMD_AINFO_GET(value) ((UINT16)(((UINT16)(value) & HFA384x_CMD_AINFO) >> 8)) | ||
822 | #define HFA384x_CMD_AINFO_SET(value) ((UINT16)((UINT16)(value) << 8)) | ||
823 | #define HFA384x_CMD_MACPORT_GET(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_MACPORT))) | ||
824 | #define HFA384x_CMD_MACPORT_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET(value)) | ||
825 | #define HFA384x_CMD_ISRECL(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_RECL))) | ||
826 | #define HFA384x_CMD_RECL_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET(value)) | ||
827 | #define HFA384x_CMD_QOS_GET(value) ((UINT16((((UINT16)(value))&((UINT16)0x3000)) >> 12)) | ||
828 | #define HFA384x_CMD_QOS_SET(value) ((UINT16)((((UINT16)(value)) << 12) & 0x3000)) | ||
829 | #define HFA384x_CMD_ISWRITE(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_WRITE))) | ||
830 | #define HFA384x_CMD_WRITE_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET((UINT16)value)) | ||
831 | #define HFA384x_CMD_PROGMODE_GET(value) ((UINT16)(HFA384x_CMD_AINFO_GET((UINT16)(value) & HFA384x_CMD_PROGMODE))) | ||
832 | #define HFA384x_CMD_PROGMODE_SET(value) ((UINT16)HFA384x_CMD_AINFO_SET((UINT16)value)) | ||
833 | #define HFA384x_CMD_CMDCODE_GET(value) ((UINT16)(((UINT16)(value)) & HFA384x_CMD_CMDCODE)) | ||
834 | #define HFA384x_CMD_CMDCODE_SET(value) ((UINT16)(value)) | ||
835 | |||
836 | #define HFA384x_STATUS_RESULT_GET(value) ((UINT16)((((UINT16)(value)) & HFA384x_STATUS_RESULT) >> 8)) | ||
837 | #define HFA384x_STATUS_RESULT_SET(value) (((UINT16)(value)) << 8) | ||
838 | #define HFA384x_STATUS_CMDCODE_GET(value) (((UINT16)(value)) & HFA384x_STATUS_CMDCODE) | ||
839 | #define HFA384x_STATUS_CMDCODE_SET(value) ((UINT16)(value)) | ||
840 | |||
841 | #define HFA384x_OFFSET_ISBUSY(value) ((UINT16)(((UINT16)(value)) & HFA384x_OFFSET_BUSY)) | ||
842 | #define HFA384x_OFFSET_ISERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_OFFSET_ERR)) | ||
843 | #define HFA384x_OFFSET_DATAOFF_GET(value) ((UINT16)(((UINT16)(value)) & HFA384x_OFFSET_DATAOFF)) | ||
844 | #define HFA384x_OFFSET_DATAOFF_SET(value) ((UINT16)(value)) | ||
845 | |||
846 | #define HFA384x_EVSTAT_ISTICK(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_TICK)) | ||
847 | #define HFA384x_EVSTAT_ISWTERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_WTERR)) | ||
848 | #define HFA384x_EVSTAT_ISINFDROP(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_INFDROP)) | ||
849 | #define HFA384x_EVSTAT_ISINFO(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_INFO)) | ||
850 | #define HFA384x_EVSTAT_ISDTIM(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_DTIM)) | ||
851 | #define HFA384x_EVSTAT_ISCMD(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_CMD)) | ||
852 | #define HFA384x_EVSTAT_ISALLOC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_ALLOC)) | ||
853 | #define HFA384x_EVSTAT_ISTXEXC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_TXEXC)) | ||
854 | #define HFA384x_EVSTAT_ISTX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_TX)) | ||
855 | #define HFA384x_EVSTAT_ISRX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVSTAT_RX)) | ||
856 | |||
857 | #define HFA384x_EVSTAT_ISBAP_OP(value) ((UINT16)(((UINT16)(value)) & HFA384x_INT_BAP_OP)) | ||
858 | |||
859 | #define HFA384x_INTEN_ISTICK(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_TICK)) | ||
860 | #define HFA384x_INTEN_TICK_SET(value) ((UINT16)(((UINT16)(value)) << 15)) | ||
861 | #define HFA384x_INTEN_ISWTERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_WTERR)) | ||
862 | #define HFA384x_INTEN_WTERR_SET(value) ((UINT16)(((UINT16)(value)) << 14)) | ||
863 | #define HFA384x_INTEN_ISINFDROP(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_INFDROP)) | ||
864 | #define HFA384x_INTEN_INFDROP_SET(value) ((UINT16)(((UINT16)(value)) << 13)) | ||
865 | #define HFA384x_INTEN_ISINFO(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_INFO)) | ||
866 | #define HFA384x_INTEN_INFO_SET(value) ((UINT16)(((UINT16)(value)) << 7)) | ||
867 | #define HFA384x_INTEN_ISDTIM(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_DTIM)) | ||
868 | #define HFA384x_INTEN_DTIM_SET(value) ((UINT16)(((UINT16)(value)) << 5)) | ||
869 | #define HFA384x_INTEN_ISCMD(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_CMD)) | ||
870 | #define HFA384x_INTEN_CMD_SET(value) ((UINT16)(((UINT16)(value)) << 4)) | ||
871 | #define HFA384x_INTEN_ISALLOC(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_ALLOC)) | ||
872 | #define HFA384x_INTEN_ALLOC_SET(value) ((UINT16)(((UINT16)(value)) << 3)) | ||
873 | #define HFA384x_INTEN_ISTXEXC(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_TXEXC)) | ||
874 | #define HFA384x_INTEN_TXEXC_SET(value) ((UINT16)(((UINT16)(value)) << 2)) | ||
875 | #define HFA384x_INTEN_ISTX(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_TX)) | ||
876 | #define HFA384x_INTEN_TX_SET(value) ((UINT16)(((UINT16)(value)) << 1)) | ||
877 | #define HFA384x_INTEN_ISRX(value) ((UINT16)(((UINT16)(value)) & HFA384x_INTEN_RX)) | ||
878 | #define HFA384x_INTEN_RX_SET(value) ((UINT16)(((UINT16)(value)) << 0)) | ||
879 | |||
880 | #define HFA384x_EVACK_ISTICK(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_TICK)) | ||
881 | #define HFA384x_EVACK_TICK_SET(value) ((UINT16)(((UINT16)(value)) << 15)) | ||
882 | #define HFA384x_EVACK_ISWTERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_WTERR)) | ||
883 | #define HFA384x_EVACK_WTERR_SET(value) ((UINT16)(((UINT16)(value)) << 14)) | ||
884 | #define HFA384x_EVACK_ISINFDROP(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_INFDROP)) | ||
885 | #define HFA384x_EVACK_INFDROP_SET(value) ((UINT16)(((UINT16)(value)) << 13)) | ||
886 | #define HFA384x_EVACK_ISINFO(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_INFO)) | ||
887 | #define HFA384x_EVACK_INFO_SET(value) ((UINT16)(((UINT16)(value)) << 7)) | ||
888 | #define HFA384x_EVACK_ISDTIM(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_DTIM)) | ||
889 | #define HFA384x_EVACK_DTIM_SET(value) ((UINT16)(((UINT16)(value)) << 5)) | ||
890 | #define HFA384x_EVACK_ISCMD(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_CMD)) | ||
891 | #define HFA384x_EVACK_CMD_SET(value) ((UINT16)(((UINT16)(value)) << 4)) | ||
892 | #define HFA384x_EVACK_ISALLOC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_ALLOC)) | ||
893 | #define HFA384x_EVACK_ALLOC_SET(value) ((UINT16)(((UINT16)(value)) << 3)) | ||
894 | #define HFA384x_EVACK_ISTXEXC(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_TXEXC)) | ||
895 | #define HFA384x_EVACK_TXEXC_SET(value) ((UINT16)(((UINT16)(value)) << 2)) | ||
896 | #define HFA384x_EVACK_ISTX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_TX)) | ||
897 | #define HFA384x_EVACK_TX_SET(value) ((UINT16)(((UINT16)(value)) << 1)) | ||
898 | #define HFA384x_EVACK_ISRX(value) ((UINT16)(((UINT16)(value)) & HFA384x_EVACK_RX)) | ||
899 | #define HFA384x_EVACK_RX_SET(value) ((UINT16)(((UINT16)(value)) << 0)) | ||
900 | |||
901 | #define HFA384x_CONTROL_AUXEN_SET(value) ((UINT16)(((UINT16)(value)) << 14)) | ||
902 | #define HFA384x_CONTROL_AUXEN_GET(value) ((UINT16)(((UINT16)(value)) >> 14)) | ||
903 | |||
904 | /* Byte Order */ | ||
905 | #ifdef __KERNEL__ | ||
906 | #define hfa384x2host_16(n) (__le16_to_cpu((UINT16)(n))) | ||
907 | #define hfa384x2host_32(n) (__le32_to_cpu((UINT32)(n))) | ||
908 | #define host2hfa384x_16(n) (__cpu_to_le16((UINT16)(n))) | ||
909 | #define host2hfa384x_32(n) (__cpu_to_le32((UINT32)(n))) | ||
910 | #endif | ||
911 | |||
912 | /* Host Maintained State Info */ | ||
913 | #define HFA384x_STATE_PREINIT 0 | ||
914 | #define HFA384x_STATE_INIT 1 | ||
915 | #define HFA384x_STATE_RUNNING 2 | ||
916 | |||
917 | /*=============================================================*/ | ||
918 | /*------ Types and their related constants --------------------*/ | ||
919 | |||
920 | #define HFA384x_HOSTAUTHASSOC_HOSTAUTH BIT0 | ||
921 | #define HFA384x_HOSTAUTHASSOC_HOSTASSOC BIT1 | ||
922 | |||
923 | #define HFA384x_WHAHANDLING_DISABLED 0 | ||
924 | #define HFA384x_WHAHANDLING_PASSTHROUGH BIT1 | ||
925 | |||
926 | /*-------------------------------------------------------------*/ | ||
927 | /* Commonly used basic types */ | ||
928 | typedef struct hfa384x_bytestr | ||
929 | { | ||
930 | UINT16 len; | ||
931 | UINT8 data[0]; | ||
932 | } __WLAN_ATTRIB_PACK__ hfa384x_bytestr_t; | ||
933 | |||
934 | typedef struct hfa384x_bytestr32 | ||
935 | { | ||
936 | UINT16 len; | ||
937 | UINT8 data[32]; | ||
938 | } __WLAN_ATTRIB_PACK__ hfa384x_bytestr32_t; | ||
939 | |||
940 | /*-------------------------------------------------------------------- | ||
941 | Configuration Record Structures: | ||
942 | Network Parameters, Static Configuration Entities | ||
943 | --------------------------------------------------------------------*/ | ||
944 | /* Prototype structure: all configuration record structures start with | ||
945 | these members */ | ||
946 | |||
947 | typedef struct hfa384x_record | ||
948 | { | ||
949 | UINT16 reclen; | ||
950 | UINT16 rid; | ||
951 | } __WLAN_ATTRIB_PACK__ hfa384x_rec_t; | ||
952 | |||
953 | typedef struct hfa384x_record16 | ||
954 | { | ||
955 | UINT16 reclen; | ||
956 | UINT16 rid; | ||
957 | UINT16 val; | ||
958 | } __WLAN_ATTRIB_PACK__ hfa384x_rec16_t; | ||
959 | |||
960 | typedef struct hfa384x_record32 | ||
961 | { | ||
962 | UINT16 reclen; | ||
963 | UINT16 rid; | ||
964 | UINT32 val; | ||
965 | } __WLAN_ATTRIB_PACK__ hfa384x_rec32; | ||
966 | |||
967 | /*-- Hardware/Firmware Component Information ----------*/ | ||
968 | typedef struct hfa384x_compident | ||
969 | { | ||
970 | UINT16 id; | ||
971 | UINT16 variant; | ||
972 | UINT16 major; | ||
973 | UINT16 minor; | ||
974 | } __WLAN_ATTRIB_PACK__ hfa384x_compident_t; | ||
975 | |||
976 | typedef struct hfa384x_caplevel | ||
977 | { | ||
978 | UINT16 role; | ||
979 | UINT16 id; | ||
980 | UINT16 variant; | ||
981 | UINT16 bottom; | ||
982 | UINT16 top; | ||
983 | } __WLAN_ATTRIB_PACK__ hfa384x_caplevel_t; | ||
984 | |||
985 | /*-- Configuration Record: cnfPortType --*/ | ||
986 | typedef struct hfa384x_cnfPortType | ||
987 | { | ||
988 | UINT16 cnfPortType; | ||
989 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfPortType_t; | ||
990 | |||
991 | /*-- Configuration Record: cnfOwnMACAddress --*/ | ||
992 | typedef struct hfa384x_cnfOwnMACAddress | ||
993 | { | ||
994 | UINT8 cnfOwnMACAddress[6]; | ||
995 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnMACAddress_t; | ||
996 | |||
997 | /*-- Configuration Record: cnfDesiredSSID --*/ | ||
998 | typedef struct hfa384x_cnfDesiredSSID | ||
999 | { | ||
1000 | UINT8 cnfDesiredSSID[34]; | ||
1001 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfDesiredSSID_t; | ||
1002 | |||
1003 | /*-- Configuration Record: cnfOwnChannel --*/ | ||
1004 | typedef struct hfa384x_cnfOwnChannel | ||
1005 | { | ||
1006 | UINT16 cnfOwnChannel; | ||
1007 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnChannel_t; | ||
1008 | |||
1009 | /*-- Configuration Record: cnfOwnSSID --*/ | ||
1010 | typedef struct hfa384x_cnfOwnSSID | ||
1011 | { | ||
1012 | UINT8 cnfOwnSSID[34]; | ||
1013 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnSSID_t; | ||
1014 | |||
1015 | /*-- Configuration Record: cnfOwnATIMWindow --*/ | ||
1016 | typedef struct hfa384x_cnfOwnATIMWindow | ||
1017 | { | ||
1018 | UINT16 cnfOwnATIMWindow; | ||
1019 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnATIMWindow_t; | ||
1020 | |||
1021 | /*-- Configuration Record: cnfSystemScale --*/ | ||
1022 | typedef struct hfa384x_cnfSystemScale | ||
1023 | { | ||
1024 | UINT16 cnfSystemScale; | ||
1025 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfSystemScale_t; | ||
1026 | |||
1027 | /*-- Configuration Record: cnfMaxDataLength --*/ | ||
1028 | typedef struct hfa384x_cnfMaxDataLength | ||
1029 | { | ||
1030 | UINT16 cnfMaxDataLength; | ||
1031 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfMaxDataLength_t; | ||
1032 | |||
1033 | /*-- Configuration Record: cnfWDSAddress --*/ | ||
1034 | typedef struct hfa384x_cnfWDSAddress | ||
1035 | { | ||
1036 | UINT8 cnfWDSAddress[6]; | ||
1037 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfWDSAddress_t; | ||
1038 | |||
1039 | /*-- Configuration Record: cnfPMEnabled --*/ | ||
1040 | typedef struct hfa384x_cnfPMEnabled | ||
1041 | { | ||
1042 | UINT16 cnfPMEnabled; | ||
1043 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMEnabled_t; | ||
1044 | |||
1045 | /*-- Configuration Record: cnfPMEPS --*/ | ||
1046 | typedef struct hfa384x_cnfPMEPS | ||
1047 | { | ||
1048 | UINT16 cnfPMEPS; | ||
1049 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMEPS_t; | ||
1050 | |||
1051 | /*-- Configuration Record: cnfMulticastReceive --*/ | ||
1052 | typedef struct hfa384x_cnfMulticastReceive | ||
1053 | { | ||
1054 | UINT16 cnfMulticastReceive; | ||
1055 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfMulticastReceive_t; | ||
1056 | |||
1057 | /*-- Configuration Record: cnfAuthentication --*/ | ||
1058 | #define HFA384x_CNFAUTHENTICATION_OPENSYSTEM 0x0001 | ||
1059 | #define HFA384x_CNFAUTHENTICATION_SHAREDKEY 0x0002 | ||
1060 | #define HFA384x_CNFAUTHENTICATION_LEAP 0x0004 | ||
1061 | |||
1062 | /*-- Configuration Record: cnfMaxSleepDuration --*/ | ||
1063 | typedef struct hfa384x_cnfMaxSleepDuration | ||
1064 | { | ||
1065 | UINT16 cnfMaxSleepDuration; | ||
1066 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfMaxSleepDuration_t; | ||
1067 | |||
1068 | /*-- Configuration Record: cnfPMHoldoverDuration --*/ | ||
1069 | typedef struct hfa384x_cnfPMHoldoverDuration | ||
1070 | { | ||
1071 | UINT16 cnfPMHoldoverDuration; | ||
1072 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfPMHoldoverDuration_t; | ||
1073 | |||
1074 | /*-- Configuration Record: cnfOwnName --*/ | ||
1075 | typedef struct hfa384x_cnfOwnName | ||
1076 | { | ||
1077 | UINT8 cnfOwnName[34]; | ||
1078 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnName_t; | ||
1079 | |||
1080 | /*-- Configuration Record: cnfOwnDTIMPeriod --*/ | ||
1081 | typedef struct hfa384x_cnfOwnDTIMPeriod | ||
1082 | { | ||
1083 | UINT16 cnfOwnDTIMPeriod; | ||
1084 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfOwnDTIMPeriod_t; | ||
1085 | |||
1086 | /*-- Configuration Record: cnfWDSAddress --*/ | ||
1087 | typedef struct hfa384x_cnfWDSAddressN | ||
1088 | { | ||
1089 | UINT8 cnfWDSAddress[6]; | ||
1090 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfWDSAddressN_t; | ||
1091 | |||
1092 | /*-- Configuration Record: cnfMulticastPMBuffering --*/ | ||
1093 | typedef struct hfa384x_cnfMulticastPMBuffering | ||
1094 | { | ||
1095 | UINT16 cnfMulticastPMBuffering; | ||
1096 | } __WLAN_ATTRIB_PACK__ hfa384x_cnfMulticastPMBuffering_t; | ||
1097 | |||
1098 | /*-------------------------------------------------------------------- | ||
1099 | Configuration Record Structures: | ||
1100 | Network Parameters, Dynamic Configuration Entities | ||
1101 | --------------------------------------------------------------------*/ | ||
1102 | |||
1103 | /*-- Configuration Record: GroupAddresses --*/ | ||
1104 | typedef struct hfa384x_GroupAddresses | ||
1105 | { | ||
1106 | UINT8 MACAddress[16][6]; | ||
1107 | } __WLAN_ATTRIB_PACK__ hfa384x_GroupAddresses_t; | ||
1108 | |||
1109 | /*-- Configuration Record: CreateIBSS --*/ | ||
1110 | typedef struct hfa384x_CreateIBSS | ||
1111 | { | ||
1112 | UINT16 CreateIBSS; | ||
1113 | } __WLAN_ATTRIB_PACK__ hfa384x_CreateIBSS_t; | ||
1114 | |||
1115 | #define HFA384x_CREATEIBSS_JOINCREATEIBSS 0 | ||
1116 | #define HFA384x_CREATEIBSS_JOINESS_JOINCREATEIBSS 1 | ||
1117 | #define HFA384x_CREATEIBSS_JOINIBSS 2 | ||
1118 | #define HFA384x_CREATEIBSS_JOINESS_JOINIBSS 3 | ||
1119 | |||
1120 | /*-- Configuration Record: FragmentationThreshold --*/ | ||
1121 | typedef struct hfa384x_FragmentationThreshold | ||
1122 | { | ||
1123 | UINT16 FragmentationThreshold; | ||
1124 | } __WLAN_ATTRIB_PACK__ hfa384x_FragmentationThreshold_t; | ||
1125 | |||
1126 | /*-- Configuration Record: RTSThreshold --*/ | ||
1127 | typedef struct hfa384x_RTSThreshold | ||
1128 | { | ||
1129 | UINT16 RTSThreshold; | ||
1130 | } __WLAN_ATTRIB_PACK__ hfa384x_RTSThreshold_t; | ||
1131 | |||
1132 | /*-- Configuration Record: TxRateControl --*/ | ||
1133 | typedef struct hfa384x_TxRateControl | ||
1134 | { | ||
1135 | UINT16 TxRateControl; | ||
1136 | } __WLAN_ATTRIB_PACK__ hfa384x_TxRateControl_t; | ||
1137 | |||
1138 | /*-- Configuration Record: PromiscuousMode --*/ | ||
1139 | typedef struct hfa384x_PromiscuousMode | ||
1140 | { | ||
1141 | UINT16 PromiscuousMode; | ||
1142 | } __WLAN_ATTRIB_PACK__ hfa384x_PromiscuousMode_t; | ||
1143 | |||
1144 | /*-- Configuration Record: ScanRequest (data portion only) --*/ | ||
1145 | typedef struct hfa384x_ScanRequest_data | ||
1146 | { | ||
1147 | UINT16 channelList; | ||
1148 | UINT16 txRate; | ||
1149 | } __WLAN_ATTRIB_PACK__ hfa384x_ScanRequest_data_t; | ||
1150 | |||
1151 | /*-- Configuration Record: HostScanRequest (data portion only) --*/ | ||
1152 | typedef struct hfa384x_HostScanRequest_data | ||
1153 | { | ||
1154 | UINT16 channelList; | ||
1155 | UINT16 txRate; | ||
1156 | hfa384x_bytestr32_t ssid; | ||
1157 | } __WLAN_ATTRIB_PACK__ hfa384x_HostScanRequest_data_t; | ||
1158 | |||
1159 | /*-- Configuration Record: JoinRequest (data portion only) --*/ | ||
1160 | typedef struct hfa384x_JoinRequest_data | ||
1161 | { | ||
1162 | UINT8 bssid[WLAN_BSSID_LEN]; | ||
1163 | UINT16 channel; | ||
1164 | } __WLAN_ATTRIB_PACK__ hfa384x_JoinRequest_data_t; | ||
1165 | |||
1166 | /*-- Configuration Record: authenticateStation (data portion only) --*/ | ||
1167 | typedef struct hfa384x_authenticateStation_data | ||
1168 | { | ||
1169 | UINT8 address[WLAN_ADDR_LEN]; | ||
1170 | UINT16 status; | ||
1171 | UINT16 algorithm; | ||
1172 | } __WLAN_ATTRIB_PACK__ hfa384x_authenticateStation_data_t; | ||
1173 | |||
1174 | /*-- Configuration Record: associateStation (data portion only) --*/ | ||
1175 | typedef struct hfa384x_associateStation_data | ||
1176 | { | ||
1177 | UINT8 address[WLAN_ADDR_LEN]; | ||
1178 | UINT16 status; | ||
1179 | UINT16 type; | ||
1180 | } __WLAN_ATTRIB_PACK__ hfa384x_associateStation_data_t; | ||
1181 | |||
1182 | /*-- Configuration Record: ChannelInfoRequest (data portion only) --*/ | ||
1183 | typedef struct hfa384x_ChannelInfoRequest_data | ||
1184 | { | ||
1185 | UINT16 channelList; | ||
1186 | UINT16 channelDwellTime; | ||
1187 | } __WLAN_ATTRIB_PACK__ hfa384x_ChannelInfoRequest_data_t; | ||
1188 | |||
1189 | /*-- Configuration Record: WEPKeyMapping (data portion only) --*/ | ||
1190 | typedef struct hfa384x_WEPKeyMapping | ||
1191 | { | ||
1192 | UINT8 address[WLAN_ADDR_LEN]; | ||
1193 | UINT16 key_index; | ||
1194 | UINT8 key[16]; | ||
1195 | UINT8 mic_transmit_key[4]; | ||
1196 | UINT8 mic_receive_key[4]; | ||
1197 | } __WLAN_ATTRIB_PACK__ hfa384x_WEPKeyMapping_t; | ||
1198 | |||
1199 | /*-- Configuration Record: WPAData (data portion only) --*/ | ||
1200 | typedef struct hfa384x_WPAData | ||
1201 | { | ||
1202 | UINT16 datalen; | ||
1203 | UINT8 data[0]; // max 80 | ||
1204 | } __WLAN_ATTRIB_PACK__ hfa384x_WPAData_t; | ||
1205 | |||
1206 | /*-------------------------------------------------------------------- | ||
1207 | Configuration Record Structures: Behavior Parameters | ||
1208 | --------------------------------------------------------------------*/ | ||
1209 | |||
1210 | /*-- Configuration Record: TickTime --*/ | ||
1211 | typedef struct hfa384x_TickTime | ||
1212 | { | ||
1213 | UINT16 TickTime; | ||
1214 | } __WLAN_ATTRIB_PACK__ hfa384x_TickTime_t; | ||
1215 | |||
1216 | /*-------------------------------------------------------------------- | ||
1217 | Information Record Structures: NIC Information | ||
1218 | --------------------------------------------------------------------*/ | ||
1219 | |||
1220 | /*-- Information Record: MaxLoadTime --*/ | ||
1221 | typedef struct hfa384x_MaxLoadTime | ||
1222 | { | ||
1223 | UINT16 MaxLoadTime; | ||
1224 | } __WLAN_ATTRIB_PACK__ hfa384x_MaxLoadTime_t; | ||
1225 | |||
1226 | /*-- Information Record: DownLoadBuffer --*/ | ||
1227 | /* NOTE: The page and offset are in AUX format */ | ||
1228 | typedef struct hfa384x_downloadbuffer | ||
1229 | { | ||
1230 | UINT16 page; | ||
1231 | UINT16 offset; | ||
1232 | UINT16 len; | ||
1233 | } __WLAN_ATTRIB_PACK__ hfa384x_downloadbuffer_t; | ||
1234 | |||
1235 | /*-- Information Record: PRIIdentity --*/ | ||
1236 | typedef struct hfa384x_PRIIdentity | ||
1237 | { | ||
1238 | UINT16 PRICompID; | ||
1239 | UINT16 PRIVariant; | ||
1240 | UINT16 PRIMajorVersion; | ||
1241 | UINT16 PRIMinorVersion; | ||
1242 | } __WLAN_ATTRIB_PACK__ hfa384x_PRIIdentity_t; | ||
1243 | |||
1244 | /*-- Information Record: PRISupRange --*/ | ||
1245 | typedef struct hfa384x_PRISupRange | ||
1246 | { | ||
1247 | UINT16 PRIRole; | ||
1248 | UINT16 PRIID; | ||
1249 | UINT16 PRIVariant; | ||
1250 | UINT16 PRIBottom; | ||
1251 | UINT16 PRITop; | ||
1252 | } __WLAN_ATTRIB_PACK__ hfa384x_PRISupRange_t; | ||
1253 | |||
1254 | /*-- Information Record: CFIActRanges --*/ | ||
1255 | typedef struct hfa384x_CFIActRanges | ||
1256 | { | ||
1257 | UINT16 CFIRole; | ||
1258 | UINT16 CFIID; | ||
1259 | UINT16 CFIVariant; | ||
1260 | UINT16 CFIBottom; | ||
1261 | UINT16 CFITop; | ||
1262 | } __WLAN_ATTRIB_PACK__ hfa384x_CFIActRanges_t; | ||
1263 | |||
1264 | /*-- Information Record: NICSerialNumber --*/ | ||
1265 | typedef struct hfa384x_NICSerialNumber | ||
1266 | { | ||
1267 | UINT8 NICSerialNumber[12]; | ||
1268 | } __WLAN_ATTRIB_PACK__ hfa384x_NICSerialNumber_t; | ||
1269 | |||
1270 | /*-- Information Record: NICIdentity --*/ | ||
1271 | typedef struct hfa384x_NICIdentity | ||
1272 | { | ||
1273 | UINT16 NICCompID; | ||
1274 | UINT16 NICVariant; | ||
1275 | UINT16 NICMajorVersion; | ||
1276 | UINT16 NICMinorVersion; | ||
1277 | } __WLAN_ATTRIB_PACK__ hfa384x_NICIdentity_t; | ||
1278 | |||
1279 | /*-- Information Record: MFISupRange --*/ | ||
1280 | typedef struct hfa384x_MFISupRange | ||
1281 | { | ||
1282 | UINT16 MFIRole; | ||
1283 | UINT16 MFIID; | ||
1284 | UINT16 MFIVariant; | ||
1285 | UINT16 MFIBottom; | ||
1286 | UINT16 MFITop; | ||
1287 | } __WLAN_ATTRIB_PACK__ hfa384x_MFISupRange_t; | ||
1288 | |||
1289 | /*-- Information Record: CFISupRange --*/ | ||
1290 | typedef struct hfa384x_CFISupRange | ||
1291 | { | ||
1292 | UINT16 CFIRole; | ||
1293 | UINT16 CFIID; | ||
1294 | UINT16 CFIVariant; | ||
1295 | UINT16 CFIBottom; | ||
1296 | UINT16 CFITop; | ||
1297 | } __WLAN_ATTRIB_PACK__ hfa384x_CFISupRange_t; | ||
1298 | |||
1299 | /*-- Information Record: BUILDSEQ:BuildSeq --*/ | ||
1300 | typedef struct hfa384x_BuildSeq { | ||
1301 | UINT16 primary; | ||
1302 | UINT16 secondary; | ||
1303 | } __WLAN_ATTRIB_PACK__ hfa384x_BuildSeq_t; | ||
1304 | |||
1305 | /*-- Information Record: FWID --*/ | ||
1306 | #define HFA384x_FWID_LEN 14 | ||
1307 | typedef struct hfa384x_FWID { | ||
1308 | UINT8 primary[HFA384x_FWID_LEN]; | ||
1309 | UINT8 secondary[HFA384x_FWID_LEN]; | ||
1310 | } __WLAN_ATTRIB_PACK__ hfa384x_FWID_t; | ||
1311 | |||
1312 | /*-- Information Record: ChannelList --*/ | ||
1313 | typedef struct hfa384x_ChannelList | ||
1314 | { | ||
1315 | UINT16 ChannelList; | ||
1316 | } __WLAN_ATTRIB_PACK__ hfa384x_ChannelList_t; | ||
1317 | |||
1318 | /*-- Information Record: RegulatoryDomains --*/ | ||
1319 | typedef struct hfa384x_RegulatoryDomains | ||
1320 | { | ||
1321 | UINT8 RegulatoryDomains[12]; | ||
1322 | } __WLAN_ATTRIB_PACK__ hfa384x_RegulatoryDomains_t; | ||
1323 | |||
1324 | /*-- Information Record: TempType --*/ | ||
1325 | typedef struct hfa384x_TempType | ||
1326 | { | ||
1327 | UINT16 TempType; | ||
1328 | } __WLAN_ATTRIB_PACK__ hfa384x_TempType_t; | ||
1329 | |||
1330 | /*-- Information Record: CIS --*/ | ||
1331 | typedef struct hfa384x_CIS | ||
1332 | { | ||
1333 | UINT8 CIS[480]; | ||
1334 | } __WLAN_ATTRIB_PACK__ hfa384x_CIS_t; | ||
1335 | |||
1336 | /*-- Information Record: STAIdentity --*/ | ||
1337 | typedef struct hfa384x_STAIdentity | ||
1338 | { | ||
1339 | UINT16 STACompID; | ||
1340 | UINT16 STAVariant; | ||
1341 | UINT16 STAMajorVersion; | ||
1342 | UINT16 STAMinorVersion; | ||
1343 | } __WLAN_ATTRIB_PACK__ hfa384x_STAIdentity_t; | ||
1344 | |||
1345 | /*-- Information Record: STASupRange --*/ | ||
1346 | typedef struct hfa384x_STASupRange | ||
1347 | { | ||
1348 | UINT16 STARole; | ||
1349 | UINT16 STAID; | ||
1350 | UINT16 STAVariant; | ||
1351 | UINT16 STABottom; | ||
1352 | UINT16 STATop; | ||
1353 | } __WLAN_ATTRIB_PACK__ hfa384x_STASupRange_t; | ||
1354 | |||
1355 | /*-- Information Record: MFIActRanges --*/ | ||
1356 | typedef struct hfa384x_MFIActRanges | ||
1357 | { | ||
1358 | UINT16 MFIRole; | ||
1359 | UINT16 MFIID; | ||
1360 | UINT16 MFIVariant; | ||
1361 | UINT16 MFIBottom; | ||
1362 | UINT16 MFITop; | ||
1363 | } __WLAN_ATTRIB_PACK__ hfa384x_MFIActRanges_t; | ||
1364 | |||
1365 | /*-------------------------------------------------------------------- | ||
1366 | Information Record Structures: NIC Information | ||
1367 | --------------------------------------------------------------------*/ | ||
1368 | |||
1369 | /*-- Information Record: PortStatus --*/ | ||
1370 | typedef struct hfa384x_PortStatus | ||
1371 | { | ||
1372 | UINT16 PortStatus; | ||
1373 | } __WLAN_ATTRIB_PACK__ hfa384x_PortStatus_t; | ||
1374 | |||
1375 | #define HFA384x_PSTATUS_DISABLED ((UINT16)1) | ||
1376 | #define HFA384x_PSTATUS_SEARCHING ((UINT16)2) | ||
1377 | #define HFA384x_PSTATUS_CONN_IBSS ((UINT16)3) | ||
1378 | #define HFA384x_PSTATUS_CONN_ESS ((UINT16)4) | ||
1379 | #define HFA384x_PSTATUS_OUTOFRANGE ((UINT16)5) | ||
1380 | #define HFA384x_PSTATUS_CONN_WDS ((UINT16)6) | ||
1381 | |||
1382 | /*-- Information Record: CurrentSSID --*/ | ||
1383 | typedef struct hfa384x_CurrentSSID | ||
1384 | { | ||
1385 | UINT8 CurrentSSID[34]; | ||
1386 | } __WLAN_ATTRIB_PACK__ hfa384x_CurrentSSID_t; | ||
1387 | |||
1388 | /*-- Information Record: CurrentBSSID --*/ | ||
1389 | typedef struct hfa384x_CurrentBSSID | ||
1390 | { | ||
1391 | UINT8 CurrentBSSID[6]; | ||
1392 | } __WLAN_ATTRIB_PACK__ hfa384x_CurrentBSSID_t; | ||
1393 | |||
1394 | /*-- Information Record: commsquality --*/ | ||
1395 | typedef struct hfa384x_commsquality | ||
1396 | { | ||
1397 | UINT16 CQ_currBSS; | ||
1398 | UINT16 ASL_currBSS; | ||
1399 | UINT16 ANL_currFC; | ||
1400 | } __WLAN_ATTRIB_PACK__ hfa384x_commsquality_t; | ||
1401 | |||
1402 | /*-- Information Record: dmbcommsquality --*/ | ||
1403 | typedef struct hfa384x_dbmcommsquality | ||
1404 | { | ||
1405 | UINT16 CQdbm_currBSS; | ||
1406 | UINT16 ASLdbm_currBSS; | ||
1407 | UINT16 ANLdbm_currFC; | ||
1408 | } __WLAN_ATTRIB_PACK__ hfa384x_dbmcommsquality_t; | ||
1409 | |||
1410 | /*-- Information Record: CurrentTxRate --*/ | ||
1411 | typedef struct hfa384x_CurrentTxRate | ||
1412 | { | ||
1413 | UINT16 CurrentTxRate; | ||
1414 | } __WLAN_ATTRIB_PACK__ hfa384x_CurrentTxRate_t; | ||
1415 | |||
1416 | /*-- Information Record: CurrentBeaconInterval --*/ | ||
1417 | typedef struct hfa384x_CurrentBeaconInterval | ||
1418 | { | ||
1419 | UINT16 CurrentBeaconInterval; | ||
1420 | } __WLAN_ATTRIB_PACK__ hfa384x_CurrentBeaconInterval_t; | ||
1421 | |||
1422 | /*-- Information Record: CurrentScaleThresholds --*/ | ||
1423 | typedef struct hfa384x_CurrentScaleThresholds | ||
1424 | { | ||
1425 | UINT16 EnergyDetectThreshold; | ||
1426 | UINT16 CarrierDetectThreshold; | ||
1427 | UINT16 DeferDetectThreshold; | ||
1428 | UINT16 CellSearchThreshold; /* Stations only */ | ||
1429 | UINT16 DeadSpotThreshold; /* Stations only */ | ||
1430 | } __WLAN_ATTRIB_PACK__ hfa384x_CurrentScaleThresholds_t; | ||
1431 | |||
1432 | /*-- Information Record: ProtocolRspTime --*/ | ||
1433 | typedef struct hfa384x_ProtocolRspTime | ||
1434 | { | ||
1435 | UINT16 ProtocolRspTime; | ||
1436 | } __WLAN_ATTRIB_PACK__ hfa384x_ProtocolRspTime_t; | ||
1437 | |||
1438 | /*-- Information Record: ShortRetryLimit --*/ | ||
1439 | typedef struct hfa384x_ShortRetryLimit | ||
1440 | { | ||
1441 | UINT16 ShortRetryLimit; | ||
1442 | } __WLAN_ATTRIB_PACK__ hfa384x_ShortRetryLimit_t; | ||
1443 | |||
1444 | /*-- Information Record: LongRetryLimit --*/ | ||
1445 | typedef struct hfa384x_LongRetryLimit | ||
1446 | { | ||
1447 | UINT16 LongRetryLimit; | ||
1448 | } __WLAN_ATTRIB_PACK__ hfa384x_LongRetryLimit_t; | ||
1449 | |||
1450 | /*-- Information Record: MaxTransmitLifetime --*/ | ||
1451 | typedef struct hfa384x_MaxTransmitLifetime | ||
1452 | { | ||
1453 | UINT16 MaxTransmitLifetime; | ||
1454 | } __WLAN_ATTRIB_PACK__ hfa384x_MaxTransmitLifetime_t; | ||
1455 | |||
1456 | /*-- Information Record: MaxReceiveLifetime --*/ | ||
1457 | typedef struct hfa384x_MaxReceiveLifetime | ||
1458 | { | ||
1459 | UINT16 MaxReceiveLifetime; | ||
1460 | } __WLAN_ATTRIB_PACK__ hfa384x_MaxReceiveLifetime_t; | ||
1461 | |||
1462 | /*-- Information Record: CFPollable --*/ | ||
1463 | typedef struct hfa384x_CFPollable | ||
1464 | { | ||
1465 | UINT16 CFPollable; | ||
1466 | } __WLAN_ATTRIB_PACK__ hfa384x_CFPollable_t; | ||
1467 | |||
1468 | /*-- Information Record: AuthenticationAlgorithms --*/ | ||
1469 | typedef struct hfa384x_AuthenticationAlgorithms | ||
1470 | { | ||
1471 | UINT16 AuthenticationType; | ||
1472 | UINT16 TypeEnabled; | ||
1473 | } __WLAN_ATTRIB_PACK__ hfa384x_AuthenticationAlgorithms_t; | ||
1474 | |||
1475 | /*-- Information Record: AuthenticationAlgorithms | ||
1476 | (data only --*/ | ||
1477 | typedef struct hfa384x_AuthenticationAlgorithms_data | ||
1478 | { | ||
1479 | UINT16 AuthenticationType; | ||
1480 | UINT16 TypeEnabled; | ||
1481 | } __WLAN_ATTRIB_PACK__ hfa384x_AuthenticationAlgorithms_data_t; | ||
1482 | |||
1483 | /*-- Information Record: PrivacyOptionImplemented --*/ | ||
1484 | typedef struct hfa384x_PrivacyOptionImplemented | ||
1485 | { | ||
1486 | UINT16 PrivacyOptionImplemented; | ||
1487 | } __WLAN_ATTRIB_PACK__ hfa384x_PrivacyOptionImplemented_t; | ||
1488 | |||
1489 | /*-- Information Record: OwnMACAddress --*/ | ||
1490 | typedef struct hfa384x_OwnMACAddress | ||
1491 | { | ||
1492 | UINT8 OwnMACAddress[6]; | ||
1493 | } __WLAN_ATTRIB_PACK__ hfa384x_OwnMACAddress_t; | ||
1494 | |||
1495 | /*-- Information Record: PCFInfo --*/ | ||
1496 | typedef struct hfa384x_PCFInfo | ||
1497 | { | ||
1498 | UINT16 MediumOccupancyLimit; | ||
1499 | UINT16 CFPPeriod; | ||
1500 | UINT16 CFPMaxDuration; | ||
1501 | UINT16 CFPFlags; | ||
1502 | } __WLAN_ATTRIB_PACK__ hfa384x_PCFInfo_t; | ||
1503 | |||
1504 | /*-- Information Record: PCFInfo (data portion only) --*/ | ||
1505 | typedef struct hfa384x_PCFInfo_data | ||
1506 | { | ||
1507 | UINT16 MediumOccupancyLimit; | ||
1508 | UINT16 CFPPeriod; | ||
1509 | UINT16 CFPMaxDuration; | ||
1510 | UINT16 CFPFlags; | ||
1511 | } __WLAN_ATTRIB_PACK__ hfa384x_PCFInfo_data_t; | ||
1512 | |||
1513 | /*-------------------------------------------------------------------- | ||
1514 | Information Record Structures: Modem Information Records | ||
1515 | --------------------------------------------------------------------*/ | ||
1516 | |||
1517 | /*-- Information Record: PHYType --*/ | ||
1518 | typedef struct hfa384x_PHYType | ||
1519 | { | ||
1520 | UINT16 PHYType; | ||
1521 | } __WLAN_ATTRIB_PACK__ hfa384x_PHYType_t; | ||
1522 | |||
1523 | /*-- Information Record: CurrentChannel --*/ | ||
1524 | typedef struct hfa384x_CurrentChannel | ||
1525 | { | ||
1526 | UINT16 CurrentChannel; | ||
1527 | } __WLAN_ATTRIB_PACK__ hfa384x_CurrentChannel_t; | ||
1528 | |||
1529 | /*-- Information Record: CurrentPowerState --*/ | ||
1530 | typedef struct hfa384x_CurrentPowerState | ||
1531 | { | ||
1532 | UINT16 CurrentPowerState; | ||
1533 | } __WLAN_ATTRIB_PACK__ hfa384x_CurrentPowerState_t; | ||
1534 | |||
1535 | /*-- Information Record: CCAMode --*/ | ||
1536 | typedef struct hfa384x_CCAMode | ||
1537 | { | ||
1538 | UINT16 CCAMode; | ||
1539 | } __WLAN_ATTRIB_PACK__ hfa384x_CCAMode_t; | ||
1540 | |||
1541 | /*-- Information Record: SupportedDataRates --*/ | ||
1542 | typedef struct hfa384x_SupportedDataRates | ||
1543 | { | ||
1544 | UINT8 SupportedDataRates[10]; | ||
1545 | } __WLAN_ATTRIB_PACK__ hfa384x_SupportedDataRates_t; | ||
1546 | |||
1547 | /*-- Information Record: LFOStatus --*/ | ||
1548 | typedef struct hfa384x_LFOStatus | ||
1549 | { | ||
1550 | UINT16 TestResults; | ||
1551 | UINT16 LFOResult; | ||
1552 | UINT16 VRHFOResult; | ||
1553 | } __WLAN_ATTRIB_PACK__ hfa384x_LFOStatus_t; | ||
1554 | |||
1555 | #define HFA384x_TESTRESULT_ALLPASSED BIT0 | ||
1556 | #define HFA384x_TESTRESULT_LFO_FAIL BIT1 | ||
1557 | #define HFA384x_TESTRESULT_VR_HF0_FAIL BIT2 | ||
1558 | #define HFA384x_HOST_FIRM_COORDINATE BIT7 | ||
1559 | #define HFA384x_TESTRESULT_COORDINATE BIT15 | ||
1560 | |||
1561 | /*-- Information Record: LEDControl --*/ | ||
1562 | typedef struct hfa384x_LEDControl | ||
1563 | { | ||
1564 | UINT16 searching_on; | ||
1565 | UINT16 searching_off; | ||
1566 | UINT16 assoc_on; | ||
1567 | UINT16 assoc_off; | ||
1568 | UINT16 activity; | ||
1569 | } __WLAN_ATTRIB_PACK__ hfa384x_LEDControl_t; | ||
1570 | |||
1571 | /*-------------------------------------------------------------------- | ||
1572 | FRAME DESCRIPTORS AND FRAME STRUCTURES | ||
1573 | |||
1574 | FRAME DESCRIPTORS: Offsets | ||
1575 | |||
1576 | ---------------------------------------------------------------------- | ||
1577 | Control Info (offset 44-51) | ||
1578 | --------------------------------------------------------------------*/ | ||
1579 | #define HFA384x_FD_STATUS_OFF ((UINT16)0x44) | ||
1580 | #define HFA384x_FD_TIME_OFF ((UINT16)0x46) | ||
1581 | #define HFA384x_FD_SWSUPPORT_OFF ((UINT16)0x4A) | ||
1582 | #define HFA384x_FD_SILENCE_OFF ((UINT16)0x4A) | ||
1583 | #define HFA384x_FD_SIGNAL_OFF ((UINT16)0x4B) | ||
1584 | #define HFA384x_FD_RATE_OFF ((UINT16)0x4C) | ||
1585 | #define HFA384x_FD_RXFLOW_OFF ((UINT16)0x4D) | ||
1586 | #define HFA384x_FD_RESERVED_OFF ((UINT16)0x4E) | ||
1587 | #define HFA384x_FD_TXCONTROL_OFF ((UINT16)0x50) | ||
1588 | /*-------------------------------------------------------------------- | ||
1589 | 802.11 Header (offset 52-6B) | ||
1590 | --------------------------------------------------------------------*/ | ||
1591 | #define HFA384x_FD_FRAMECONTROL_OFF ((UINT16)0x52) | ||
1592 | #define HFA384x_FD_DURATIONID_OFF ((UINT16)0x54) | ||
1593 | #define HFA384x_FD_ADDRESS1_OFF ((UINT16)0x56) | ||
1594 | #define HFA384x_FD_ADDRESS2_OFF ((UINT16)0x5C) | ||
1595 | #define HFA384x_FD_ADDRESS3_OFF ((UINT16)0x62) | ||
1596 | #define HFA384x_FD_SEQCONTROL_OFF ((UINT16)0x68) | ||
1597 | #define HFA384x_FD_ADDRESS4_OFF ((UINT16)0x6A) | ||
1598 | #define HFA384x_FD_DATALEN_OFF ((UINT16)0x70) | ||
1599 | /*-------------------------------------------------------------------- | ||
1600 | 802.3 Header (offset 72-7F) | ||
1601 | --------------------------------------------------------------------*/ | ||
1602 | #define HFA384x_FD_DESTADDRESS_OFF ((UINT16)0x72) | ||
1603 | #define HFA384x_FD_SRCADDRESS_OFF ((UINT16)0x78) | ||
1604 | #define HFA384x_FD_DATALENGTH_OFF ((UINT16)0x7E) | ||
1605 | |||
1606 | /*-------------------------------------------------------------------- | ||
1607 | FRAME STRUCTURES: Communication Frames | ||
1608 | ---------------------------------------------------------------------- | ||
1609 | Communication Frames: Transmit Frames | ||
1610 | --------------------------------------------------------------------*/ | ||
1611 | /*-- Communication Frame: Transmit Frame Structure --*/ | ||
1612 | typedef struct hfa384x_tx_frame | ||
1613 | { | ||
1614 | UINT16 status; | ||
1615 | UINT16 reserved1; | ||
1616 | UINT16 reserved2; | ||
1617 | UINT32 sw_support; | ||
1618 | UINT8 tx_retrycount; | ||
1619 | UINT8 tx_rate; | ||
1620 | UINT16 tx_control; | ||
1621 | |||
1622 | /*-- 802.11 Header Information --*/ | ||
1623 | |||
1624 | UINT16 frame_control; | ||
1625 | UINT16 duration_id; | ||
1626 | UINT8 address1[6]; | ||
1627 | UINT8 address2[6]; | ||
1628 | UINT8 address3[6]; | ||
1629 | UINT16 sequence_control; | ||
1630 | UINT8 address4[6]; | ||
1631 | UINT16 data_len; /* little endian format */ | ||
1632 | |||
1633 | /*-- 802.3 Header Information --*/ | ||
1634 | |||
1635 | UINT8 dest_addr[6]; | ||
1636 | UINT8 src_addr[6]; | ||
1637 | UINT16 data_length; /* big endian format */ | ||
1638 | } __WLAN_ATTRIB_PACK__ hfa384x_tx_frame_t; | ||
1639 | /*-------------------------------------------------------------------- | ||
1640 | Communication Frames: Field Masks for Transmit Frames | ||
1641 | --------------------------------------------------------------------*/ | ||
1642 | /*-- Status Field --*/ | ||
1643 | #define HFA384x_TXSTATUS_ACKERR ((UINT16)BIT5) | ||
1644 | #define HFA384x_TXSTATUS_FORMERR ((UINT16)BIT3) | ||
1645 | #define HFA384x_TXSTATUS_DISCON ((UINT16)BIT2) | ||
1646 | #define HFA384x_TXSTATUS_AGEDERR ((UINT16)BIT1) | ||
1647 | #define HFA384x_TXSTATUS_RETRYERR ((UINT16)BIT0) | ||
1648 | /*-- Transmit Control Field --*/ | ||
1649 | #define HFA384x_TX_CFPOLL ((UINT16)BIT12) | ||
1650 | #define HFA384x_TX_PRST ((UINT16)BIT11) | ||
1651 | #define HFA384x_TX_MACPORT ((UINT16)(BIT10 | BIT9 | BIT8)) | ||
1652 | #define HFA384x_TX_NOENCRYPT ((UINT16)BIT7) | ||
1653 | #define HFA384x_TX_RETRYSTRAT ((UINT16)(BIT6 | BIT5)) | ||
1654 | #define HFA384x_TX_STRUCTYPE ((UINT16)(BIT4 | BIT3)) | ||
1655 | #define HFA384x_TX_TXEX ((UINT16)BIT2) | ||
1656 | #define HFA384x_TX_TXOK ((UINT16)BIT1) | ||
1657 | /*-------------------------------------------------------------------- | ||
1658 | Communication Frames: Test/Get/Set Field Values for Transmit Frames | ||
1659 | --------------------------------------------------------------------*/ | ||
1660 | /*-- Status Field --*/ | ||
1661 | #define HFA384x_TXSTATUS_ISERROR(v) \ | ||
1662 | (((UINT16)(v))&\ | ||
1663 | (HFA384x_TXSTATUS_ACKERR|HFA384x_TXSTATUS_FORMERR|\ | ||
1664 | HFA384x_TXSTATUS_DISCON|HFA384x_TXSTATUS_AGEDERR|\ | ||
1665 | HFA384x_TXSTATUS_RETRYERR)) | ||
1666 | |||
1667 | #define HFA384x_TXSTATUS_ISACKERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_ACKERR)) | ||
1668 | #define HFA384x_TXSTATUS_ISFORMERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_FORMERR)) | ||
1669 | #define HFA384x_TXSTATUS_ISDISCON(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_DISCON)) | ||
1670 | #define HFA384x_TXSTATUS_ISAGEDERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_AGEDERR)) | ||
1671 | #define HFA384x_TXSTATUS_ISRETRYERR(v) ((UINT16)(((UINT16)(v)) & HFA384x_TXSTATUS_RETRYERR)) | ||
1672 | |||
1673 | #define HFA384x_TX_GET(v,m,s) ((((UINT16)(v))&((UINT16)(m)))>>((UINT16)(s))) | ||
1674 | #define HFA384x_TX_SET(v,m,s) ((((UINT16)(v))<<((UINT16)(s)))&((UINT16)(m))) | ||
1675 | |||
1676 | #define HFA384x_TX_CFPOLL_GET(v) HFA384x_TX_GET(v, HFA384x_TX_CFPOLL,12) | ||
1677 | #define HFA384x_TX_CFPOLL_SET(v) HFA384x_TX_SET(v, HFA384x_TX_CFPOLL,12) | ||
1678 | #define HFA384x_TX_PRST_GET(v) HFA384x_TX_GET(v, HFA384x_TX_PRST,11) | ||
1679 | #define HFA384x_TX_PRST_SET(v) HFA384x_TX_SET(v, HFA384x_TX_PRST,11) | ||
1680 | #define HFA384x_TX_MACPORT_GET(v) HFA384x_TX_GET(v, HFA384x_TX_MACPORT, 8) | ||
1681 | #define HFA384x_TX_MACPORT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_MACPORT, 8) | ||
1682 | #define HFA384x_TX_NOENCRYPT_GET(v) HFA384x_TX_GET(v, HFA384x_TX_NOENCRYPT, 7) | ||
1683 | #define HFA384x_TX_NOENCRYPT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_NOENCRYPT, 7) | ||
1684 | #define HFA384x_TX_RETRYSTRAT_GET(v) HFA384x_TX_GET(v, HFA384x_TX_RETRYSTRAT, 5) | ||
1685 | #define HFA384x_TX_RETRYSTRAT_SET(v) HFA384x_TX_SET(v, HFA384x_TX_RETRYSTRAT, 5) | ||
1686 | #define HFA384x_TX_STRUCTYPE_GET(v) HFA384x_TX_GET(v, HFA384x_TX_STRUCTYPE, 3) | ||
1687 | #define HFA384x_TX_STRUCTYPE_SET(v) HFA384x_TX_SET(v, HFA384x_TX_STRUCTYPE, 3) | ||
1688 | #define HFA384x_TX_TXEX_GET(v) HFA384x_TX_GET(v, HFA384x_TX_TXEX, 2) | ||
1689 | #define HFA384x_TX_TXEX_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXEX, 2) | ||
1690 | #define HFA384x_TX_TXOK_GET(v) HFA384x_TX_GET(v, HFA384x_TX_TXOK, 1) | ||
1691 | #define HFA384x_TX_TXOK_SET(v) HFA384x_TX_SET(v, HFA384x_TX_TXOK, 1) | ||
1692 | /*-------------------------------------------------------------------- | ||
1693 | Communication Frames: Receive Frames | ||
1694 | --------------------------------------------------------------------*/ | ||
1695 | /*-- Communication Frame: Receive Frame Structure --*/ | ||
1696 | typedef struct hfa384x_rx_frame | ||
1697 | { | ||
1698 | /*-- MAC rx descriptor (hfa384x byte order) --*/ | ||
1699 | UINT16 status; | ||
1700 | UINT32 time; | ||
1701 | UINT8 silence; | ||
1702 | UINT8 signal; | ||
1703 | UINT8 rate; | ||
1704 | UINT8 rx_flow; | ||
1705 | UINT16 reserved1; | ||
1706 | UINT16 reserved2; | ||
1707 | |||
1708 | /*-- 802.11 Header Information (802.11 byte order) --*/ | ||
1709 | UINT16 frame_control; | ||
1710 | UINT16 duration_id; | ||
1711 | UINT8 address1[6]; | ||
1712 | UINT8 address2[6]; | ||
1713 | UINT8 address3[6]; | ||
1714 | UINT16 sequence_control; | ||
1715 | UINT8 address4[6]; | ||
1716 | UINT16 data_len; /* hfa384x (little endian) format */ | ||
1717 | |||
1718 | /*-- 802.3 Header Information --*/ | ||
1719 | UINT8 dest_addr[6]; | ||
1720 | UINT8 src_addr[6]; | ||
1721 | UINT16 data_length; /* IEEE? (big endian) format */ | ||
1722 | } __WLAN_ATTRIB_PACK__ hfa384x_rx_frame_t; | ||
1723 | /*-------------------------------------------------------------------- | ||
1724 | Communication Frames: Field Masks for Receive Frames | ||
1725 | --------------------------------------------------------------------*/ | ||
1726 | /*-- Offsets --------*/ | ||
1727 | #define HFA384x_RX_DATA_LEN_OFF ((UINT16)44) | ||
1728 | #define HFA384x_RX_80211HDR_OFF ((UINT16)14) | ||
1729 | #define HFA384x_RX_DATA_OFF ((UINT16)60) | ||
1730 | |||
1731 | /*-- Status Fields --*/ | ||
1732 | #define HFA384x_RXSTATUS_MSGTYPE ((UINT16)(BIT15 | BIT14 | BIT13)) | ||
1733 | #define HFA384x_RXSTATUS_MACPORT ((UINT16)(BIT10 | BIT9 | BIT8)) | ||
1734 | #define HFA384x_RXSTATUS_UNDECR ((UINT16)BIT1) | ||
1735 | #define HFA384x_RXSTATUS_FCSERR ((UINT16)BIT0) | ||
1736 | /*-------------------------------------------------------------------- | ||
1737 | Communication Frames: Test/Get/Set Field Values for Receive Frames | ||
1738 | --------------------------------------------------------------------*/ | ||
1739 | #define HFA384x_RXSTATUS_MSGTYPE_GET(value) ((UINT16)((((UINT16)(value)) & HFA384x_RXSTATUS_MSGTYPE) >> 13)) | ||
1740 | #define HFA384x_RXSTATUS_MSGTYPE_SET(value) ((UINT16)(((UINT16)(value)) << 13)) | ||
1741 | #define HFA384x_RXSTATUS_MACPORT_GET(value) ((UINT16)((((UINT16)(value)) & HFA384x_RXSTATUS_MACPORT) >> 8)) | ||
1742 | #define HFA384x_RXSTATUS_MACPORT_SET(value) ((UINT16)(((UINT16)(value)) << 8)) | ||
1743 | #define HFA384x_RXSTATUS_ISUNDECR(value) ((UINT16)(((UINT16)(value)) & HFA384x_RXSTATUS_UNDECR)) | ||
1744 | #define HFA384x_RXSTATUS_ISFCSERR(value) ((UINT16)(((UINT16)(value)) & HFA384x_RXSTATUS_FCSERR)) | ||
1745 | /*-------------------------------------------------------------------- | ||
1746 | FRAME STRUCTURES: Information Types and Information Frame Structures | ||
1747 | ---------------------------------------------------------------------- | ||
1748 | Information Types | ||
1749 | --------------------------------------------------------------------*/ | ||
1750 | #define HFA384x_IT_HANDOVERADDR ((UINT16)0xF000UL) | ||
1751 | #define HFA384x_IT_HANDOVERDEAUTHADDRESS ((UINT16)0xF001UL)//AP 1.3.7 | ||
1752 | #define HFA384x_IT_COMMTALLIES ((UINT16)0xF100UL) | ||
1753 | #define HFA384x_IT_SCANRESULTS ((UINT16)0xF101UL) | ||
1754 | #define HFA384x_IT_CHINFORESULTS ((UINT16)0xF102UL) | ||
1755 | #define HFA384x_IT_HOSTSCANRESULTS ((UINT16)0xF103UL) | ||
1756 | #define HFA384x_IT_LINKSTATUS ((UINT16)0xF200UL) | ||
1757 | #define HFA384x_IT_ASSOCSTATUS ((UINT16)0xF201UL) | ||
1758 | #define HFA384x_IT_AUTHREQ ((UINT16)0xF202UL) | ||
1759 | #define HFA384x_IT_PSUSERCNT ((UINT16)0xF203UL) | ||
1760 | #define HFA384x_IT_KEYIDCHANGED ((UINT16)0xF204UL) | ||
1761 | #define HFA384x_IT_ASSOCREQ ((UINT16)0xF205UL) | ||
1762 | #define HFA384x_IT_MICFAILURE ((UINT16)0xF206UL) | ||
1763 | |||
1764 | /*-------------------------------------------------------------------- | ||
1765 | Information Frames Structures | ||
1766 | ---------------------------------------------------------------------- | ||
1767 | Information Frames: Notification Frame Structures | ||
1768 | --------------------------------------------------------------------*/ | ||
1769 | /*-- Notification Frame,MAC Mgmt: Handover Address --*/ | ||
1770 | typedef struct hfa384x_HandoverAddr | ||
1771 | { | ||
1772 | UINT16 framelen; | ||
1773 | UINT16 infotype; | ||
1774 | UINT8 handover_addr[WLAN_BSSID_LEN]; | ||
1775 | } __WLAN_ATTRIB_PACK__ hfa384x_HandoverAddr_t; | ||
1776 | |||
1777 | /*-- Inquiry Frame, Diagnose: Communication Tallies --*/ | ||
1778 | typedef struct hfa384x_CommTallies16 | ||
1779 | { | ||
1780 | UINT16 txunicastframes; | ||
1781 | UINT16 txmulticastframes; | ||
1782 | UINT16 txfragments; | ||
1783 | UINT16 txunicastoctets; | ||
1784 | UINT16 txmulticastoctets; | ||
1785 | UINT16 txdeferredtrans; | ||
1786 | UINT16 txsingleretryframes; | ||
1787 | UINT16 txmultipleretryframes; | ||
1788 | UINT16 txretrylimitexceeded; | ||
1789 | UINT16 txdiscards; | ||
1790 | UINT16 rxunicastframes; | ||
1791 | UINT16 rxmulticastframes; | ||
1792 | UINT16 rxfragments; | ||
1793 | UINT16 rxunicastoctets; | ||
1794 | UINT16 rxmulticastoctets; | ||
1795 | UINT16 rxfcserrors; | ||
1796 | UINT16 rxdiscardsnobuffer; | ||
1797 | UINT16 txdiscardswrongsa; | ||
1798 | UINT16 rxdiscardswepundecr; | ||
1799 | UINT16 rxmsginmsgfrag; | ||
1800 | UINT16 rxmsginbadmsgfrag; | ||
1801 | } __WLAN_ATTRIB_PACK__ hfa384x_CommTallies16_t; | ||
1802 | |||
1803 | typedef struct hfa384x_CommTallies32 | ||
1804 | { | ||
1805 | UINT32 txunicastframes; | ||
1806 | UINT32 txmulticastframes; | ||
1807 | UINT32 txfragments; | ||
1808 | UINT32 txunicastoctets; | ||
1809 | UINT32 txmulticastoctets; | ||
1810 | UINT32 txdeferredtrans; | ||
1811 | UINT32 txsingleretryframes; | ||
1812 | UINT32 txmultipleretryframes; | ||
1813 | UINT32 txretrylimitexceeded; | ||
1814 | UINT32 txdiscards; | ||
1815 | UINT32 rxunicastframes; | ||
1816 | UINT32 rxmulticastframes; | ||
1817 | UINT32 rxfragments; | ||
1818 | UINT32 rxunicastoctets; | ||
1819 | UINT32 rxmulticastoctets; | ||
1820 | UINT32 rxfcserrors; | ||
1821 | UINT32 rxdiscardsnobuffer; | ||
1822 | UINT32 txdiscardswrongsa; | ||
1823 | UINT32 rxdiscardswepundecr; | ||
1824 | UINT32 rxmsginmsgfrag; | ||
1825 | UINT32 rxmsginbadmsgfrag; | ||
1826 | } __WLAN_ATTRIB_PACK__ hfa384x_CommTallies32_t; | ||
1827 | |||
1828 | /*-- Inquiry Frame, Diagnose: Scan Results & Subfields--*/ | ||
1829 | typedef struct hfa384x_ScanResultSub | ||
1830 | { | ||
1831 | UINT16 chid; | ||
1832 | UINT16 anl; | ||
1833 | UINT16 sl; | ||
1834 | UINT8 bssid[WLAN_BSSID_LEN]; | ||
1835 | UINT16 bcnint; | ||
1836 | UINT16 capinfo; | ||
1837 | hfa384x_bytestr32_t ssid; | ||
1838 | UINT8 supprates[10]; /* 802.11 info element */ | ||
1839 | UINT16 proberesp_rate; | ||
1840 | } __WLAN_ATTRIB_PACK__ hfa384x_ScanResultSub_t; | ||
1841 | |||
1842 | typedef struct hfa384x_ScanResult | ||
1843 | { | ||
1844 | UINT16 rsvd; | ||
1845 | UINT16 scanreason; | ||
1846 | hfa384x_ScanResultSub_t | ||
1847 | result[HFA384x_SCANRESULT_MAX]; | ||
1848 | } __WLAN_ATTRIB_PACK__ hfa384x_ScanResult_t; | ||
1849 | |||
1850 | /*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/ | ||
1851 | typedef struct hfa384x_ChInfoResultSub | ||
1852 | { | ||
1853 | UINT16 chid; | ||
1854 | UINT16 anl; | ||
1855 | UINT16 pnl; | ||
1856 | UINT16 active; | ||
1857 | } __WLAN_ATTRIB_PACK__ hfa384x_ChInfoResultSub_t; | ||
1858 | |||
1859 | #define HFA384x_CHINFORESULT_BSSACTIVE BIT0 | ||
1860 | #define HFA384x_CHINFORESULT_PCFACTIVE BIT1 | ||
1861 | |||
1862 | typedef struct hfa384x_ChInfoResult | ||
1863 | { | ||
1864 | UINT16 scanchannels; | ||
1865 | hfa384x_ChInfoResultSub_t | ||
1866 | result[HFA384x_CHINFORESULT_MAX]; | ||
1867 | } __WLAN_ATTRIB_PACK__ hfa384x_ChInfoResult_t; | ||
1868 | |||
1869 | /*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/ | ||
1870 | typedef struct hfa384x_HScanResultSub | ||
1871 | { | ||
1872 | UINT16 chid; | ||
1873 | UINT16 anl; | ||
1874 | UINT16 sl; | ||
1875 | UINT8 bssid[WLAN_BSSID_LEN]; | ||
1876 | UINT16 bcnint; | ||
1877 | UINT16 capinfo; | ||
1878 | hfa384x_bytestr32_t ssid; | ||
1879 | UINT8 supprates[10]; /* 802.11 info element */ | ||
1880 | UINT16 proberesp_rate; | ||
1881 | UINT16 atim; | ||
1882 | } __WLAN_ATTRIB_PACK__ hfa384x_HScanResultSub_t; | ||
1883 | |||
1884 | typedef struct hfa384x_HScanResult | ||
1885 | { | ||
1886 | UINT16 nresult; | ||
1887 | UINT16 rsvd; | ||
1888 | hfa384x_HScanResultSub_t | ||
1889 | result[HFA384x_HSCANRESULT_MAX]; | ||
1890 | } __WLAN_ATTRIB_PACK__ hfa384x_HScanResult_t; | ||
1891 | |||
1892 | /*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/ | ||
1893 | |||
1894 | #define HFA384x_LINK_NOTCONNECTED ((UINT16)0) | ||
1895 | #define HFA384x_LINK_CONNECTED ((UINT16)1) | ||
1896 | #define HFA384x_LINK_DISCONNECTED ((UINT16)2) | ||
1897 | #define HFA384x_LINK_AP_CHANGE ((UINT16)3) | ||
1898 | #define HFA384x_LINK_AP_OUTOFRANGE ((UINT16)4) | ||
1899 | #define HFA384x_LINK_AP_INRANGE ((UINT16)5) | ||
1900 | #define HFA384x_LINK_ASSOCFAIL ((UINT16)6) | ||
1901 | |||
1902 | typedef struct hfa384x_LinkStatus | ||
1903 | { | ||
1904 | UINT16 linkstatus; | ||
1905 | } __WLAN_ATTRIB_PACK__ hfa384x_LinkStatus_t; | ||
1906 | |||
1907 | |||
1908 | /*-- Unsolicited Frame, MAC Mgmt: AssociationStatus (--*/ | ||
1909 | |||
1910 | #define HFA384x_ASSOCSTATUS_STAASSOC ((UINT16)1) | ||
1911 | #define HFA384x_ASSOCSTATUS_REASSOC ((UINT16)2) | ||
1912 | #define HFA384x_ASSOCSTATUS_DISASSOC ((UINT16)3) | ||
1913 | #define HFA384x_ASSOCSTATUS_ASSOCFAIL ((UINT16)4) | ||
1914 | #define HFA384x_ASSOCSTATUS_AUTHFAIL ((UINT16)5) | ||
1915 | |||
1916 | typedef struct hfa384x_AssocStatus | ||
1917 | { | ||
1918 | UINT16 assocstatus; | ||
1919 | UINT8 sta_addr[WLAN_ADDR_LEN]; | ||
1920 | /* old_ap_addr is only valid if assocstatus == 2 */ | ||
1921 | UINT8 old_ap_addr[WLAN_ADDR_LEN]; | ||
1922 | UINT16 reason; | ||
1923 | UINT16 reserved; | ||
1924 | } __WLAN_ATTRIB_PACK__ hfa384x_AssocStatus_t; | ||
1925 | |||
1926 | /*-- Unsolicited Frame, MAC Mgmt: AuthRequest (AP Only) --*/ | ||
1927 | |||
1928 | typedef struct hfa384x_AuthRequest | ||
1929 | { | ||
1930 | UINT8 sta_addr[WLAN_ADDR_LEN]; | ||
1931 | UINT16 algorithm; | ||
1932 | } __WLAN_ATTRIB_PACK__ hfa384x_AuthReq_t; | ||
1933 | |||
1934 | /*-- Unsolicited Frame, MAC Mgmt: AssocRequest (AP Only) --*/ | ||
1935 | |||
1936 | typedef struct hfa384x_AssocRequest | ||
1937 | { | ||
1938 | UINT8 sta_addr[WLAN_ADDR_LEN]; | ||
1939 | UINT16 type; | ||
1940 | UINT8 wpa_data[80]; | ||
1941 | } __WLAN_ATTRIB_PACK__ hfa384x_AssocReq_t; | ||
1942 | |||
1943 | |||
1944 | #define HFA384x_ASSOCREQ_TYPE_ASSOC 0 | ||
1945 | #define HFA384x_ASSOCREQ_TYPE_REASSOC 1 | ||
1946 | |||
1947 | /*-- Unsolicited Frame, MAC Mgmt: MIC Failure (AP Only) --*/ | ||
1948 | |||
1949 | typedef struct hfa384x_MicFailure | ||
1950 | { | ||
1951 | UINT8 sender[WLAN_ADDR_LEN]; | ||
1952 | UINT8 dest[WLAN_ADDR_LEN]; | ||
1953 | } __WLAN_ATTRIB_PACK__ hfa384x_MicFailure_t; | ||
1954 | |||
1955 | /*-- Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/ | ||
1956 | |||
1957 | typedef struct hfa384x_PSUserCount | ||
1958 | { | ||
1959 | UINT16 usercnt; | ||
1960 | } __WLAN_ATTRIB_PACK__ hfa384x_PSUserCount_t; | ||
1961 | |||
1962 | typedef struct hfa384x_KeyIDChanged | ||
1963 | { | ||
1964 | UINT8 sta_addr[WLAN_ADDR_LEN]; | ||
1965 | UINT16 keyid; | ||
1966 | } __WLAN_ATTRIB_PACK__ hfa384x_KeyIDChanged_t; | ||
1967 | |||
1968 | /*-- Collection of all Inf frames ---------------*/ | ||
1969 | typedef union hfa384x_infodata { | ||
1970 | hfa384x_CommTallies16_t commtallies16; | ||
1971 | hfa384x_CommTallies32_t commtallies32; | ||
1972 | hfa384x_ScanResult_t scanresult; | ||
1973 | hfa384x_ChInfoResult_t chinforesult; | ||
1974 | hfa384x_HScanResult_t hscanresult; | ||
1975 | hfa384x_LinkStatus_t linkstatus; | ||
1976 | hfa384x_AssocStatus_t assocstatus; | ||
1977 | hfa384x_AuthReq_t authreq; | ||
1978 | hfa384x_PSUserCount_t psusercnt; | ||
1979 | hfa384x_KeyIDChanged_t keyidchanged; | ||
1980 | } __WLAN_ATTRIB_PACK__ hfa384x_infodata_t; | ||
1981 | |||
1982 | typedef struct hfa384x_InfFrame | ||
1983 | { | ||
1984 | UINT16 framelen; | ||
1985 | UINT16 infotype; | ||
1986 | hfa384x_infodata_t info; | ||
1987 | } __WLAN_ATTRIB_PACK__ hfa384x_InfFrame_t; | ||
1988 | |||
1989 | #if (WLAN_HOSTIF == WLAN_USB) | ||
1990 | /*-------------------------------------------------------------------- | ||
1991 | USB Packet structures and constants. | ||
1992 | --------------------------------------------------------------------*/ | ||
1993 | |||
1994 | /* Should be sent to the ctrlout endpoint */ | ||
1995 | #define HFA384x_USB_ENBULKIN 6 | ||
1996 | |||
1997 | /* Should be sent to the bulkout endpoint */ | ||
1998 | #define HFA384x_USB_TXFRM 0 | ||
1999 | #define HFA384x_USB_CMDREQ 1 | ||
2000 | #define HFA384x_USB_WRIDREQ 2 | ||
2001 | #define HFA384x_USB_RRIDREQ 3 | ||
2002 | #define HFA384x_USB_WMEMREQ 4 | ||
2003 | #define HFA384x_USB_RMEMREQ 5 | ||
2004 | |||
2005 | /* Received from the bulkin endpoint */ | ||
2006 | #define HFA384x_USB_ISFRM(a) (!((a) & 0x8000)) | ||
2007 | #define HFA384x_USB_ISTXFRM(a) (((a) & 0x9000) == 0x1000) | ||
2008 | #define HFA384x_USB_ISRXFRM(a) (!((a) & 0x9000)) | ||
2009 | #define HFA384x_USB_INFOFRM 0x8000 | ||
2010 | #define HFA384x_USB_CMDRESP 0x8001 | ||
2011 | #define HFA384x_USB_WRIDRESP 0x8002 | ||
2012 | #define HFA384x_USB_RRIDRESP 0x8003 | ||
2013 | #define HFA384x_USB_WMEMRESP 0x8004 | ||
2014 | #define HFA384x_USB_RMEMRESP 0x8005 | ||
2015 | #define HFA384x_USB_BUFAVAIL 0x8006 | ||
2016 | #define HFA384x_USB_ERROR 0x8007 | ||
2017 | |||
2018 | /*------------------------------------*/ | ||
2019 | /* Request (bulk OUT) packet contents */ | ||
2020 | |||
2021 | typedef struct hfa384x_usb_txfrm { | ||
2022 | hfa384x_tx_frame_t desc; | ||
2023 | UINT8 data[WLAN_DATA_MAXLEN]; | ||
2024 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_txfrm_t; | ||
2025 | |||
2026 | typedef struct hfa384x_usb_cmdreq { | ||
2027 | UINT16 type; | ||
2028 | UINT16 cmd; | ||
2029 | UINT16 parm0; | ||
2030 | UINT16 parm1; | ||
2031 | UINT16 parm2; | ||
2032 | UINT8 pad[54]; | ||
2033 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdreq_t; | ||
2034 | |||
2035 | typedef struct hfa384x_usb_wridreq { | ||
2036 | UINT16 type; | ||
2037 | UINT16 frmlen; | ||
2038 | UINT16 rid; | ||
2039 | UINT8 data[HFA384x_RIDDATA_MAXLEN]; | ||
2040 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_wridreq_t; | ||
2041 | |||
2042 | typedef struct hfa384x_usb_rridreq { | ||
2043 | UINT16 type; | ||
2044 | UINT16 frmlen; | ||
2045 | UINT16 rid; | ||
2046 | UINT8 pad[58]; | ||
2047 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_rridreq_t; | ||
2048 | |||
2049 | typedef struct hfa384x_usb_wmemreq { | ||
2050 | UINT16 type; | ||
2051 | UINT16 frmlen; | ||
2052 | UINT16 offset; | ||
2053 | UINT16 page; | ||
2054 | UINT8 data[HFA384x_USB_RWMEM_MAXLEN]; | ||
2055 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_wmemreq_t; | ||
2056 | |||
2057 | typedef struct hfa384x_usb_rmemreq { | ||
2058 | UINT16 type; | ||
2059 | UINT16 frmlen; | ||
2060 | UINT16 offset; | ||
2061 | UINT16 page; | ||
2062 | UINT8 pad[56]; | ||
2063 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemreq_t; | ||
2064 | |||
2065 | /*------------------------------------*/ | ||
2066 | /* Response (bulk IN) packet contents */ | ||
2067 | |||
2068 | typedef struct hfa384x_usb_rxfrm { | ||
2069 | hfa384x_rx_frame_t desc; | ||
2070 | UINT8 data[WLAN_DATA_MAXLEN]; | ||
2071 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_rxfrm_t; | ||
2072 | |||
2073 | typedef struct hfa384x_usb_infofrm { | ||
2074 | UINT16 type; | ||
2075 | hfa384x_InfFrame_t info; | ||
2076 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_infofrm_t; | ||
2077 | |||
2078 | typedef struct hfa384x_usb_statusresp { | ||
2079 | UINT16 type; | ||
2080 | UINT16 status; | ||
2081 | UINT16 resp0; | ||
2082 | UINT16 resp1; | ||
2083 | UINT16 resp2; | ||
2084 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_cmdresp_t; | ||
2085 | |||
2086 | typedef hfa384x_usb_cmdresp_t hfa384x_usb_wridresp_t; | ||
2087 | |||
2088 | typedef struct hfa384x_usb_rridresp { | ||
2089 | UINT16 type; | ||
2090 | UINT16 frmlen; | ||
2091 | UINT16 rid; | ||
2092 | UINT8 data[HFA384x_RIDDATA_MAXLEN]; | ||
2093 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_rridresp_t; | ||
2094 | |||
2095 | typedef hfa384x_usb_cmdresp_t hfa384x_usb_wmemresp_t; | ||
2096 | |||
2097 | typedef struct hfa384x_usb_rmemresp { | ||
2098 | UINT16 type; | ||
2099 | UINT16 frmlen; | ||
2100 | UINT8 data[HFA384x_USB_RWMEM_MAXLEN]; | ||
2101 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_rmemresp_t; | ||
2102 | |||
2103 | typedef struct hfa384x_usb_bufavail { | ||
2104 | UINT16 type; | ||
2105 | UINT16 frmlen; | ||
2106 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_bufavail_t; | ||
2107 | |||
2108 | typedef struct hfa384x_usb_error { | ||
2109 | UINT16 type; | ||
2110 | UINT16 errortype; | ||
2111 | } __WLAN_ATTRIB_PACK__ hfa384x_usb_error_t; | ||
2112 | |||
2113 | /*----------------------------------------------------------*/ | ||
2114 | /* Unions for packaging all the known packet types together */ | ||
2115 | |||
2116 | typedef union hfa384x_usbout { | ||
2117 | UINT16 type; | ||
2118 | hfa384x_usb_txfrm_t txfrm; | ||
2119 | hfa384x_usb_cmdreq_t cmdreq; | ||
2120 | hfa384x_usb_wridreq_t wridreq; | ||
2121 | hfa384x_usb_rridreq_t rridreq; | ||
2122 | hfa384x_usb_wmemreq_t wmemreq; | ||
2123 | hfa384x_usb_rmemreq_t rmemreq; | ||
2124 | } __WLAN_ATTRIB_PACK__ hfa384x_usbout_t; | ||
2125 | |||
2126 | typedef union hfa384x_usbin { | ||
2127 | UINT16 type; | ||
2128 | hfa384x_usb_rxfrm_t rxfrm; | ||
2129 | hfa384x_usb_txfrm_t txfrm; | ||
2130 | hfa384x_usb_infofrm_t infofrm; | ||
2131 | hfa384x_usb_cmdresp_t cmdresp; | ||
2132 | hfa384x_usb_wridresp_t wridresp; | ||
2133 | hfa384x_usb_rridresp_t rridresp; | ||
2134 | hfa384x_usb_wmemresp_t wmemresp; | ||
2135 | hfa384x_usb_rmemresp_t rmemresp; | ||
2136 | hfa384x_usb_bufavail_t bufavail; | ||
2137 | hfa384x_usb_error_t usberror; | ||
2138 | UINT8 boguspad[3000]; | ||
2139 | } __WLAN_ATTRIB_PACK__ hfa384x_usbin_t; | ||
2140 | |||
2141 | #endif /* WLAN_USB */ | ||
2142 | |||
2143 | /*-------------------------------------------------------------------- | ||
2144 | PD record structures. | ||
2145 | --------------------------------------------------------------------*/ | ||
2146 | |||
2147 | typedef struct hfa384x_pdr_pcb_partnum | ||
2148 | { | ||
2149 | UINT8 num[8]; | ||
2150 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_pcb_partnum_t; | ||
2151 | |||
2152 | typedef struct hfa384x_pdr_pcb_tracenum | ||
2153 | { | ||
2154 | UINT8 num[8]; | ||
2155 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_pcb_tracenum_t; | ||
2156 | |||
2157 | typedef struct hfa384x_pdr_nic_serial | ||
2158 | { | ||
2159 | UINT8 num[12]; | ||
2160 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_serial_t; | ||
2161 | |||
2162 | typedef struct hfa384x_pdr_mkk_measurements | ||
2163 | { | ||
2164 | double carrier_freq; | ||
2165 | double occupied_band; | ||
2166 | double power_density; | ||
2167 | double tx_spur_f1; | ||
2168 | double tx_spur_f2; | ||
2169 | double tx_spur_f3; | ||
2170 | double tx_spur_f4; | ||
2171 | double tx_spur_l1; | ||
2172 | double tx_spur_l2; | ||
2173 | double tx_spur_l3; | ||
2174 | double tx_spur_l4; | ||
2175 | double rx_spur_f1; | ||
2176 | double rx_spur_f2; | ||
2177 | double rx_spur_l1; | ||
2178 | double rx_spur_l2; | ||
2179 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mkk_measurements_t; | ||
2180 | |||
2181 | typedef struct hfa384x_pdr_nic_ramsize | ||
2182 | { | ||
2183 | UINT8 size[12]; /* units of KB */ | ||
2184 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_ramsize_t; | ||
2185 | |||
2186 | typedef struct hfa384x_pdr_mfisuprange | ||
2187 | { | ||
2188 | UINT16 id; | ||
2189 | UINT16 variant; | ||
2190 | UINT16 bottom; | ||
2191 | UINT16 top; | ||
2192 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mfisuprange_t; | ||
2193 | |||
2194 | typedef struct hfa384x_pdr_cfisuprange | ||
2195 | { | ||
2196 | UINT16 id; | ||
2197 | UINT16 variant; | ||
2198 | UINT16 bottom; | ||
2199 | UINT16 top; | ||
2200 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_cfisuprange_t; | ||
2201 | |||
2202 | typedef struct hfa384x_pdr_nicid | ||
2203 | { | ||
2204 | UINT16 id; | ||
2205 | UINT16 variant; | ||
2206 | UINT16 major; | ||
2207 | UINT16 minor; | ||
2208 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nicid_t; | ||
2209 | |||
2210 | |||
2211 | typedef struct hfa384x_pdr_refdac_measurements | ||
2212 | { | ||
2213 | UINT16 value[0]; | ||
2214 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_refdac_measurements_t; | ||
2215 | |||
2216 | typedef struct hfa384x_pdr_vgdac_measurements | ||
2217 | { | ||
2218 | UINT16 value[0]; | ||
2219 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_vgdac_measurements_t; | ||
2220 | |||
2221 | typedef struct hfa384x_pdr_level_comp_measurements | ||
2222 | { | ||
2223 | UINT16 value[0]; | ||
2224 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_level_compc_measurements_t; | ||
2225 | |||
2226 | typedef struct hfa384x_pdr_mac_address | ||
2227 | { | ||
2228 | UINT8 addr[6]; | ||
2229 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mac_address_t; | ||
2230 | |||
2231 | typedef struct hfa384x_pdr_mkk_callname | ||
2232 | { | ||
2233 | UINT8 callname[8]; | ||
2234 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_mkk_callname_t; | ||
2235 | |||
2236 | typedef struct hfa384x_pdr_regdomain | ||
2237 | { | ||
2238 | UINT16 numdomains; | ||
2239 | UINT16 domain[5]; | ||
2240 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_regdomain_t; | ||
2241 | |||
2242 | typedef struct hfa384x_pdr_allowed_channel | ||
2243 | { | ||
2244 | UINT16 ch_bitmap; | ||
2245 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_allowed_channel_t; | ||
2246 | |||
2247 | typedef struct hfa384x_pdr_default_channel | ||
2248 | { | ||
2249 | UINT16 channel; | ||
2250 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_default_channel_t; | ||
2251 | |||
2252 | typedef struct hfa384x_pdr_privacy_option | ||
2253 | { | ||
2254 | UINT16 available; | ||
2255 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_privacy_option_t; | ||
2256 | |||
2257 | typedef struct hfa384x_pdr_temptype | ||
2258 | { | ||
2259 | UINT16 type; | ||
2260 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_temptype_t; | ||
2261 | |||
2262 | typedef struct hfa384x_pdr_refdac_setup | ||
2263 | { | ||
2264 | UINT16 ch_value[14]; | ||
2265 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_refdac_setup_t; | ||
2266 | |||
2267 | typedef struct hfa384x_pdr_vgdac_setup | ||
2268 | { | ||
2269 | UINT16 ch_value[14]; | ||
2270 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_vgdac_setup_t; | ||
2271 | |||
2272 | typedef struct hfa384x_pdr_level_comp_setup | ||
2273 | { | ||
2274 | UINT16 ch_value[14]; | ||
2275 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_level_comp_setup_t; | ||
2276 | |||
2277 | typedef struct hfa384x_pdr_trimdac_setup | ||
2278 | { | ||
2279 | UINT16 trimidac; | ||
2280 | UINT16 trimqdac; | ||
2281 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_trimdac_setup_t; | ||
2282 | |||
2283 | typedef struct hfa384x_pdr_ifr_setting | ||
2284 | { | ||
2285 | UINT16 value[3]; | ||
2286 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_ifr_setting_t; | ||
2287 | |||
2288 | typedef struct hfa384x_pdr_rfr_setting | ||
2289 | { | ||
2290 | UINT16 value[3]; | ||
2291 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_rfr_setting_t; | ||
2292 | |||
2293 | typedef struct hfa384x_pdr_hfa3861_baseline | ||
2294 | { | ||
2295 | UINT16 value[50]; | ||
2296 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_baseline_t; | ||
2297 | |||
2298 | typedef struct hfa384x_pdr_hfa3861_shadow | ||
2299 | { | ||
2300 | UINT32 value[32]; | ||
2301 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_shadow_t; | ||
2302 | |||
2303 | typedef struct hfa384x_pdr_hfa3861_ifrf | ||
2304 | { | ||
2305 | UINT32 value[20]; | ||
2306 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_ifrf_t; | ||
2307 | |||
2308 | typedef struct hfa384x_pdr_hfa3861_chcalsp | ||
2309 | { | ||
2310 | UINT16 value[14]; | ||
2311 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_chcalsp_t; | ||
2312 | |||
2313 | typedef struct hfa384x_pdr_hfa3861_chcali | ||
2314 | { | ||
2315 | UINT16 value[17]; | ||
2316 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_chcali_t; | ||
2317 | |||
2318 | typedef struct hfa384x_pdr_hfa3861_nic_config | ||
2319 | { | ||
2320 | UINT16 config_bitmap; | ||
2321 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_nic_config_t; | ||
2322 | |||
2323 | typedef struct hfa384x_pdr_hfo_delay | ||
2324 | { | ||
2325 | UINT8 hfo_delay; | ||
2326 | } __WLAN_ATTRIB_PACK__ hfa384x_hfo_delay_t; | ||
2327 | |||
2328 | typedef struct hfa384x_pdr_hfa3861_manf_testsp | ||
2329 | { | ||
2330 | UINT16 value[30]; | ||
2331 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_manf_testsp_t; | ||
2332 | |||
2333 | typedef struct hfa384x_pdr_hfa3861_manf_testi | ||
2334 | { | ||
2335 | UINT16 value[30]; | ||
2336 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_hfa3861_manf_testi_t; | ||
2337 | |||
2338 | typedef struct hfa384x_end_of_pda | ||
2339 | { | ||
2340 | UINT16 crc; | ||
2341 | } __WLAN_ATTRIB_PACK__ hfa384x_pdr_end_of_pda_t; | ||
2342 | |||
2343 | typedef struct hfa384x_pdrec | ||
2344 | { | ||
2345 | UINT16 len; /* in words */ | ||
2346 | UINT16 code; | ||
2347 | union pdr { | ||
2348 | hfa384x_pdr_pcb_partnum_t pcb_partnum; | ||
2349 | hfa384x_pdr_pcb_tracenum_t pcb_tracenum; | ||
2350 | hfa384x_pdr_nic_serial_t nic_serial; | ||
2351 | hfa384x_pdr_mkk_measurements_t mkk_measurements; | ||
2352 | hfa384x_pdr_nic_ramsize_t nic_ramsize; | ||
2353 | hfa384x_pdr_mfisuprange_t mfisuprange; | ||
2354 | hfa384x_pdr_cfisuprange_t cfisuprange; | ||
2355 | hfa384x_pdr_nicid_t nicid; | ||
2356 | hfa384x_pdr_refdac_measurements_t refdac_measurements; | ||
2357 | hfa384x_pdr_vgdac_measurements_t vgdac_measurements; | ||
2358 | hfa384x_pdr_level_compc_measurements_t level_compc_measurements; | ||
2359 | hfa384x_pdr_mac_address_t mac_address; | ||
2360 | hfa384x_pdr_mkk_callname_t mkk_callname; | ||
2361 | hfa384x_pdr_regdomain_t regdomain; | ||
2362 | hfa384x_pdr_allowed_channel_t allowed_channel; | ||
2363 | hfa384x_pdr_default_channel_t default_channel; | ||
2364 | hfa384x_pdr_privacy_option_t privacy_option; | ||
2365 | hfa384x_pdr_temptype_t temptype; | ||
2366 | hfa384x_pdr_refdac_setup_t refdac_setup; | ||
2367 | hfa384x_pdr_vgdac_setup_t vgdac_setup; | ||
2368 | hfa384x_pdr_level_comp_setup_t level_comp_setup; | ||
2369 | hfa384x_pdr_trimdac_setup_t trimdac_setup; | ||
2370 | hfa384x_pdr_ifr_setting_t ifr_setting; | ||
2371 | hfa384x_pdr_rfr_setting_t rfr_setting; | ||
2372 | hfa384x_pdr_hfa3861_baseline_t hfa3861_baseline; | ||
2373 | hfa384x_pdr_hfa3861_shadow_t hfa3861_shadow; | ||
2374 | hfa384x_pdr_hfa3861_ifrf_t hfa3861_ifrf; | ||
2375 | hfa384x_pdr_hfa3861_chcalsp_t hfa3861_chcalsp; | ||
2376 | hfa384x_pdr_hfa3861_chcali_t hfa3861_chcali; | ||
2377 | hfa384x_pdr_nic_config_t nic_config; | ||
2378 | hfa384x_hfo_delay_t hfo_delay; | ||
2379 | hfa384x_pdr_hfa3861_manf_testsp_t hfa3861_manf_testsp; | ||
2380 | hfa384x_pdr_hfa3861_manf_testi_t hfa3861_manf_testi; | ||
2381 | hfa384x_pdr_end_of_pda_t end_of_pda; | ||
2382 | |||
2383 | } data; | ||
2384 | } __WLAN_ATTRIB_PACK__ hfa384x_pdrec_t; | ||
2385 | |||
2386 | |||
2387 | #ifdef __KERNEL__ | ||
2388 | /*-------------------------------------------------------------------- | ||
2389 | --- MAC state structure, argument to all functions -- | ||
2390 | --- Also, a collection of support types -- | ||
2391 | --------------------------------------------------------------------*/ | ||
2392 | typedef struct hfa384x_statusresult | ||
2393 | { | ||
2394 | UINT16 status; | ||
2395 | UINT16 resp0; | ||
2396 | UINT16 resp1; | ||
2397 | UINT16 resp2; | ||
2398 | } hfa384x_cmdresult_t; | ||
2399 | |||
2400 | #if (WLAN_HOSTIF == WLAN_USB) | ||
2401 | |||
2402 | /* USB Control Exchange (CTLX): | ||
2403 | * A queue of the structure below is maintained for all of the | ||
2404 | * Request/Response type USB packets supported by Prism2. | ||
2405 | */ | ||
2406 | /* The following hfa384x_* structures are arguments to | ||
2407 | * the usercb() for the different CTLX types. | ||
2408 | */ | ||
2409 | typedef hfa384x_cmdresult_t hfa384x_wridresult_t; | ||
2410 | typedef hfa384x_cmdresult_t hfa384x_wmemresult_t; | ||
2411 | |||
2412 | typedef struct hfa384x_rridresult | ||
2413 | { | ||
2414 | UINT16 rid; | ||
2415 | const void *riddata; | ||
2416 | UINT riddata_len; | ||
2417 | } hfa384x_rridresult_t; | ||
2418 | |||
2419 | enum ctlx_state { | ||
2420 | CTLX_START = 0, /* Start state, not queued */ | ||
2421 | |||
2422 | CTLX_COMPLETE, /* CTLX successfully completed */ | ||
2423 | CTLX_REQ_FAILED, /* OUT URB completed w/ error */ | ||
2424 | |||
2425 | CTLX_PENDING, /* Queued, data valid */ | ||
2426 | CTLX_REQ_SUBMITTED, /* OUT URB submitted */ | ||
2427 | CTLX_REQ_COMPLETE, /* OUT URB complete */ | ||
2428 | CTLX_RESP_COMPLETE /* IN URB received */ | ||
2429 | }; | ||
2430 | typedef enum ctlx_state CTLX_STATE; | ||
2431 | |||
2432 | struct hfa384x_usbctlx; | ||
2433 | struct hfa384x; | ||
2434 | |||
2435 | typedef void (*ctlx_cmdcb_t)( struct hfa384x*, const struct hfa384x_usbctlx* ); | ||
2436 | |||
2437 | typedef void (*ctlx_usercb_t)( | ||
2438 | struct hfa384x *hw, | ||
2439 | void *ctlxresult, | ||
2440 | void *usercb_data); | ||
2441 | |||
2442 | typedef struct hfa384x_usbctlx | ||
2443 | { | ||
2444 | struct list_head list; | ||
2445 | |||
2446 | size_t outbufsize; | ||
2447 | hfa384x_usbout_t outbuf; /* pkt buf for OUT */ | ||
2448 | hfa384x_usbin_t inbuf; /* pkt buf for IN(a copy) */ | ||
2449 | |||
2450 | CTLX_STATE state; /* Tracks running state */ | ||
2451 | |||
2452 | struct completion done; | ||
2453 | volatile int reapable; /* Food for the reaper task */ | ||
2454 | |||
2455 | ctlx_cmdcb_t cmdcb; /* Async command callback */ | ||
2456 | ctlx_usercb_t usercb; /* Async user callback, */ | ||
2457 | void *usercb_data; /* at CTLX completion */ | ||
2458 | |||
2459 | int variant; /* Identifies cmd variant */ | ||
2460 | } hfa384x_usbctlx_t; | ||
2461 | |||
2462 | typedef struct hfa384x_usbctlxq | ||
2463 | { | ||
2464 | spinlock_t lock; | ||
2465 | struct list_head pending; | ||
2466 | struct list_head active; | ||
2467 | struct list_head completing; | ||
2468 | struct list_head reapable; | ||
2469 | } hfa384x_usbctlxq_t; | ||
2470 | #endif | ||
2471 | |||
2472 | typedef struct hfa484x_metacmd | ||
2473 | { | ||
2474 | UINT16 cmd; | ||
2475 | |||
2476 | UINT16 parm0; | ||
2477 | UINT16 parm1; | ||
2478 | UINT16 parm2; | ||
2479 | |||
2480 | #if 0 //XXX cmd irq stuff | ||
2481 | UINT16 bulkid; /* what RID/FID to copy down. */ | ||
2482 | int bulklen; /* how much to copy from BAP */ | ||
2483 | char *bulkdata; /* And to where? */ | ||
2484 | #endif | ||
2485 | |||
2486 | hfa384x_cmdresult_t result; | ||
2487 | } hfa384x_metacmd_t; | ||
2488 | |||
2489 | #define MAX_PRISM2_GRP_ADDR 16 | ||
2490 | #define MAX_GRP_ADDR 32 | ||
2491 | #define WLAN_COMMENT_MAX 80 /* Max. length of user comment string. */ | ||
2492 | |||
2493 | #define MM_SAT_PCF (BIT14) | ||
2494 | #define MM_GCSD_PCF (BIT15) | ||
2495 | #define MM_GCSD_PCF_EB (BIT14 | BIT15) | ||
2496 | |||
2497 | #define WLAN_STATE_STOPPED 0 /* Network is not active. */ | ||
2498 | #define WLAN_STATE_STARTED 1 /* Network has been started. */ | ||
2499 | |||
2500 | #define WLAN_AUTH_MAX 60 /* Max. # of authenticated stations. */ | ||
2501 | #define WLAN_ACCESS_MAX 60 /* Max. # of stations in an access list. */ | ||
2502 | #define WLAN_ACCESS_NONE 0 /* No stations may be authenticated. */ | ||
2503 | #define WLAN_ACCESS_ALL 1 /* All stations may be authenticated. */ | ||
2504 | #define WLAN_ACCESS_ALLOW 2 /* Authenticate only "allowed" stations. */ | ||
2505 | #define WLAN_ACCESS_DENY 3 /* Do not authenticate "denied" stations. */ | ||
2506 | |||
2507 | /* XXX These are going away ASAP */ | ||
2508 | typedef struct prism2sta_authlist | ||
2509 | { | ||
2510 | UINT cnt; | ||
2511 | UINT8 addr[WLAN_AUTH_MAX][WLAN_ADDR_LEN]; | ||
2512 | UINT8 assoc[WLAN_AUTH_MAX]; | ||
2513 | } prism2sta_authlist_t; | ||
2514 | |||
2515 | typedef struct prism2sta_accesslist | ||
2516 | { | ||
2517 | UINT modify; | ||
2518 | UINT cnt; | ||
2519 | UINT8 addr[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; | ||
2520 | UINT cnt1; | ||
2521 | UINT8 addr1[WLAN_ACCESS_MAX][WLAN_ADDR_LEN]; | ||
2522 | } prism2sta_accesslist_t; | ||
2523 | |||
2524 | typedef struct hfa384x | ||
2525 | { | ||
2526 | #if (WLAN_HOSTIF != WLAN_USB) | ||
2527 | /* Resource config */ | ||
2528 | UINT32 iobase; | ||
2529 | char __iomem *membase; | ||
2530 | UINT32 irq; | ||
2531 | #else | ||
2532 | /* USB support data */ | ||
2533 | struct usb_device *usb; | ||
2534 | struct urb rx_urb; | ||
2535 | struct sk_buff *rx_urb_skb; | ||
2536 | struct urb tx_urb; | ||
2537 | struct urb ctlx_urb; | ||
2538 | hfa384x_usbout_t txbuff; | ||
2539 | hfa384x_usbctlxq_t ctlxq; | ||
2540 | struct timer_list reqtimer; | ||
2541 | struct timer_list resptimer; | ||
2542 | |||
2543 | struct timer_list throttle; | ||
2544 | |||
2545 | struct tasklet_struct reaper_bh; | ||
2546 | struct tasklet_struct completion_bh; | ||
2547 | |||
2548 | struct work_struct usb_work; | ||
2549 | |||
2550 | unsigned long usb_flags; | ||
2551 | #define THROTTLE_RX 0 | ||
2552 | #define THROTTLE_TX 1 | ||
2553 | #define WORK_RX_HALT 2 | ||
2554 | #define WORK_TX_HALT 3 | ||
2555 | #define WORK_RX_RESUME 4 | ||
2556 | #define WORK_TX_RESUME 5 | ||
2557 | |||
2558 | unsigned short req_timer_done:1; | ||
2559 | unsigned short resp_timer_done:1; | ||
2560 | |||
2561 | int endp_in; | ||
2562 | int endp_out; | ||
2563 | #endif /* !USB */ | ||
2564 | |||
2565 | #if (WLAN_HOSTIF == WLAN_PCMCIA) | ||
2566 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
2567 | struct pcmcia_device *pdev; | ||
2568 | #else | ||
2569 | dev_link_t *link; | ||
2570 | #endif | ||
2571 | dev_node_t node; | ||
2572 | #endif | ||
2573 | |||
2574 | int sniff_fcs; | ||
2575 | int sniff_channel; | ||
2576 | int sniff_truncate; | ||
2577 | int sniffhdr; | ||
2578 | |||
2579 | wait_queue_head_t cmdq; /* wait queue itself */ | ||
2580 | |||
2581 | /* Controller state */ | ||
2582 | UINT32 state; | ||
2583 | UINT32 isap; | ||
2584 | UINT8 port_enabled[HFA384x_NUMPORTS_MAX]; | ||
2585 | #if (WLAN_HOSTIF != WLAN_USB) | ||
2586 | UINT auxen; | ||
2587 | UINT isram16; | ||
2588 | #endif /* !USB */ | ||
2589 | |||
2590 | /* Download support */ | ||
2591 | UINT dlstate; | ||
2592 | hfa384x_downloadbuffer_t bufinfo; | ||
2593 | UINT16 dltimeout; | ||
2594 | |||
2595 | #if (WLAN_HOSTIF != WLAN_USB) | ||
2596 | spinlock_t cmdlock; | ||
2597 | volatile int cmdflag; /* wait queue flag */ | ||
2598 | hfa384x_metacmd_t *cmddata; /* for our async callback */ | ||
2599 | |||
2600 | /* BAP support */ | ||
2601 | spinlock_t baplock; | ||
2602 | struct tasklet_struct bap_tasklet; | ||
2603 | |||
2604 | /* MAC buffer ids */ | ||
2605 | UINT16 txfid_head; | ||
2606 | UINT16 txfid_tail; | ||
2607 | UINT txfid_N; | ||
2608 | UINT16 txfid_queue[HFA384x_DRVR_FIDSTACKLEN_MAX]; | ||
2609 | UINT16 infofid; | ||
2610 | struct semaphore infofid_sem; | ||
2611 | #endif /* !USB */ | ||
2612 | |||
2613 | int scanflag; /* to signal scan comlete */ | ||
2614 | int join_ap; /* are we joined to a specific ap */ | ||
2615 | int join_retries; /* number of join retries till we fail */ | ||
2616 | hfa384x_JoinRequest_data_t joinreq; /* join request saved data */ | ||
2617 | |||
2618 | wlandevice_t *wlandev; | ||
2619 | /* Timer to allow for the deferred processing of linkstatus messages */ | ||
2620 | struct work_struct link_bh; | ||
2621 | |||
2622 | struct work_struct commsqual_bh; | ||
2623 | hfa384x_commsquality_t qual; | ||
2624 | struct timer_list commsqual_timer; | ||
2625 | |||
2626 | UINT16 link_status; | ||
2627 | UINT16 link_status_new; | ||
2628 | struct sk_buff_head authq; | ||
2629 | |||
2630 | /* And here we have stuff that used to be in priv */ | ||
2631 | |||
2632 | /* State variables */ | ||
2633 | UINT presniff_port_type; | ||
2634 | UINT16 presniff_wepflags; | ||
2635 | UINT32 dot11_desired_bss_type; | ||
2636 | int ap; /* AP flag: 0 - Station, 1 - Access Point. */ | ||
2637 | |||
2638 | int dbmadjust; | ||
2639 | |||
2640 | /* Group Addresses - right now, there are up to a total | ||
2641 | of MAX_GRP_ADDR group addresses */ | ||
2642 | UINT8 dot11_grp_addr[MAX_GRP_ADDR][WLAN_ADDR_LEN]; | ||
2643 | UINT dot11_grpcnt; | ||
2644 | |||
2645 | /* Component Identities */ | ||
2646 | hfa384x_compident_t ident_nic; | ||
2647 | hfa384x_compident_t ident_pri_fw; | ||
2648 | hfa384x_compident_t ident_sta_fw; | ||
2649 | hfa384x_compident_t ident_ap_fw; | ||
2650 | UINT16 mm_mods; | ||
2651 | |||
2652 | /* Supplier compatibility ranges */ | ||
2653 | hfa384x_caplevel_t cap_sup_mfi; | ||
2654 | hfa384x_caplevel_t cap_sup_cfi; | ||
2655 | hfa384x_caplevel_t cap_sup_pri; | ||
2656 | hfa384x_caplevel_t cap_sup_sta; | ||
2657 | hfa384x_caplevel_t cap_sup_ap; | ||
2658 | |||
2659 | /* Actor compatibility ranges */ | ||
2660 | hfa384x_caplevel_t cap_act_pri_cfi; /* pri f/w to controller interface */ | ||
2661 | hfa384x_caplevel_t cap_act_sta_cfi; /* sta f/w to controller interface */ | ||
2662 | hfa384x_caplevel_t cap_act_sta_mfi; /* sta f/w to modem interface */ | ||
2663 | hfa384x_caplevel_t cap_act_ap_cfi; /* ap f/w to controller interface */ | ||
2664 | hfa384x_caplevel_t cap_act_ap_mfi; /* ap f/w to modem interface */ | ||
2665 | |||
2666 | UINT32 psusercount; /* Power save user count. */ | ||
2667 | hfa384x_CommTallies32_t tallies; /* Communication tallies. */ | ||
2668 | UINT8 comment[WLAN_COMMENT_MAX+1]; /* User comment */ | ||
2669 | |||
2670 | /* Channel Info request results (AP only) */ | ||
2671 | struct { | ||
2672 | atomic_t done; | ||
2673 | UINT8 count; | ||
2674 | hfa384x_ChInfoResult_t results; | ||
2675 | } channel_info; | ||
2676 | |||
2677 | hfa384x_InfFrame_t *scanresults; | ||
2678 | |||
2679 | |||
2680 | prism2sta_authlist_t authlist; /* Authenticated station list. */ | ||
2681 | UINT accessmode; /* Access mode. */ | ||
2682 | prism2sta_accesslist_t allow; /* Allowed station list. */ | ||
2683 | prism2sta_accesslist_t deny; /* Denied station list. */ | ||
2684 | |||
2685 | } hfa384x_t; | ||
2686 | |||
2687 | /*=============================================================*/ | ||
2688 | /*--- Function Declarations -----------------------------------*/ | ||
2689 | /*=============================================================*/ | ||
2690 | #if (WLAN_HOSTIF == WLAN_USB) | ||
2691 | void | ||
2692 | hfa384x_create( | ||
2693 | hfa384x_t *hw, | ||
2694 | struct usb_device *usb); | ||
2695 | #else | ||
2696 | void | ||
2697 | hfa384x_create( | ||
2698 | hfa384x_t *hw, | ||
2699 | UINT irq, | ||
2700 | UINT32 iobase, | ||
2701 | UINT8 __iomem *membase); | ||
2702 | #endif | ||
2703 | |||
2704 | void hfa384x_destroy(hfa384x_t *hw); | ||
2705 | |||
2706 | irqreturn_t | ||
2707 | hfa384x_interrupt(int irq, void *dev_id PT_REGS); | ||
2708 | int | ||
2709 | hfa384x_corereset( hfa384x_t *hw, int holdtime, int settletime, int genesis); | ||
2710 | int | ||
2711 | hfa384x_drvr_chinforesults( hfa384x_t *hw); | ||
2712 | int | ||
2713 | hfa384x_drvr_commtallies( hfa384x_t *hw); | ||
2714 | int | ||
2715 | hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport); | ||
2716 | int | ||
2717 | hfa384x_drvr_enable(hfa384x_t *hw, UINT16 macport); | ||
2718 | int | ||
2719 | hfa384x_drvr_flashdl_enable(hfa384x_t *hw); | ||
2720 | int | ||
2721 | hfa384x_drvr_flashdl_disable(hfa384x_t *hw); | ||
2722 | int | ||
2723 | hfa384x_drvr_flashdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len); | ||
2724 | int | ||
2725 | hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len); | ||
2726 | int | ||
2727 | hfa384x_drvr_handover( hfa384x_t *hw, UINT8 *addr); | ||
2728 | int | ||
2729 | hfa384x_drvr_hostscanresults( hfa384x_t *hw); | ||
2730 | int | ||
2731 | hfa384x_drvr_low_level(hfa384x_t *hw, hfa384x_metacmd_t *cmd); | ||
2732 | int | ||
2733 | hfa384x_drvr_mmi_read(hfa384x_t *hw, UINT32 address, UINT32 *result); | ||
2734 | int | ||
2735 | hfa384x_drvr_mmi_write(hfa384x_t *hw, UINT32 address, UINT32 data); | ||
2736 | int | ||
2737 | hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr); | ||
2738 | int | ||
2739 | hfa384x_drvr_ramdl_disable(hfa384x_t *hw); | ||
2740 | int | ||
2741 | hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len); | ||
2742 | int | ||
2743 | hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len); | ||
2744 | int | ||
2745 | hfa384x_drvr_scanresults( hfa384x_t *hw); | ||
2746 | |||
2747 | int | ||
2748 | hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len); | ||
2749 | |||
2750 | static inline int | ||
2751 | hfa384x_drvr_getconfig16(hfa384x_t *hw, UINT16 rid, void *val) | ||
2752 | { | ||
2753 | int result = 0; | ||
2754 | result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT16)); | ||
2755 | if ( result == 0 ) { | ||
2756 | *((UINT16*)val) = hfa384x2host_16(*((UINT16*)val)); | ||
2757 | } | ||
2758 | return result; | ||
2759 | } | ||
2760 | |||
2761 | static inline int | ||
2762 | hfa384x_drvr_getconfig32(hfa384x_t *hw, UINT16 rid, void *val) | ||
2763 | { | ||
2764 | int result = 0; | ||
2765 | |||
2766 | result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(UINT32)); | ||
2767 | if ( result == 0 ) { | ||
2768 | *((UINT32*)val) = hfa384x2host_32(*((UINT32*)val)); | ||
2769 | } | ||
2770 | |||
2771 | return result; | ||
2772 | } | ||
2773 | |||
2774 | static inline int | ||
2775 | hfa384x_drvr_setconfig16(hfa384x_t *hw, UINT16 rid, UINT16 val) | ||
2776 | { | ||
2777 | UINT16 value = host2hfa384x_16(val); | ||
2778 | return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); | ||
2779 | } | ||
2780 | |||
2781 | static inline int | ||
2782 | hfa384x_drvr_setconfig32(hfa384x_t *hw, UINT16 rid, UINT32 val) | ||
2783 | { | ||
2784 | UINT32 value = host2hfa384x_32(val); | ||
2785 | return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); | ||
2786 | } | ||
2787 | |||
2788 | #if (WLAN_HOSTIF == WLAN_USB) | ||
2789 | int | ||
2790 | hfa384x_drvr_getconfig_async(hfa384x_t *hw, | ||
2791 | UINT16 rid, | ||
2792 | ctlx_usercb_t usercb, | ||
2793 | void *usercb_data); | ||
2794 | |||
2795 | int | ||
2796 | hfa384x_drvr_setconfig_async(hfa384x_t *hw, | ||
2797 | UINT16 rid, | ||
2798 | void *buf, | ||
2799 | UINT16 len, | ||
2800 | ctlx_usercb_t usercb, | ||
2801 | void *usercb_data); | ||
2802 | #else | ||
2803 | static inline int | ||
2804 | hfa384x_drvr_setconfig_async(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len, | ||
2805 | void *ptr1, void *ptr2) | ||
2806 | { | ||
2807 | (void)ptr1; | ||
2808 | (void)ptr2; | ||
2809 | return hfa384x_drvr_setconfig(hw, rid, buf, len); | ||
2810 | } | ||
2811 | #endif | ||
2812 | |||
2813 | static inline int | ||
2814 | hfa384x_drvr_setconfig16_async(hfa384x_t *hw, UINT16 rid, UINT16 val) | ||
2815 | { | ||
2816 | UINT16 value = host2hfa384x_16(val); | ||
2817 | return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), | ||
2818 | NULL , NULL); | ||
2819 | } | ||
2820 | |||
2821 | static inline int | ||
2822 | hfa384x_drvr_setconfig32_async(hfa384x_t *hw, UINT16 rid, UINT32 val) | ||
2823 | { | ||
2824 | UINT32 value = host2hfa384x_32(val); | ||
2825 | return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), | ||
2826 | NULL , NULL); | ||
2827 | } | ||
2828 | |||
2829 | |||
2830 | int | ||
2831 | hfa384x_drvr_start(hfa384x_t *hw); | ||
2832 | int | ||
2833 | hfa384x_drvr_stop(hfa384x_t *hw); | ||
2834 | int | ||
2835 | hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep); | ||
2836 | void | ||
2837 | hfa384x_tx_timeout(wlandevice_t *wlandev); | ||
2838 | |||
2839 | int | ||
2840 | hfa384x_cmd_initialize(hfa384x_t *hw); | ||
2841 | int | ||
2842 | hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport); | ||
2843 | int | ||
2844 | hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport); | ||
2845 | int | ||
2846 | hfa384x_cmd_diagnose(hfa384x_t *hw); | ||
2847 | int | ||
2848 | hfa384x_cmd_allocate(hfa384x_t *hw, UINT16 len); | ||
2849 | int | ||
2850 | hfa384x_cmd_transmit(hfa384x_t *hw, UINT16 reclaim, UINT16 qos, UINT16 fid); | ||
2851 | int | ||
2852 | hfa384x_cmd_clearpersist(hfa384x_t *hw, UINT16 fid); | ||
2853 | int | ||
2854 | hfa384x_cmd_notify(hfa384x_t *hw, UINT16 reclaim, UINT16 fid, void *buf, UINT16 len); | ||
2855 | int | ||
2856 | hfa384x_cmd_inquire(hfa384x_t *hw, UINT16 fid); | ||
2857 | int | ||
2858 | hfa384x_cmd_access(hfa384x_t *hw, UINT16 write, UINT16 rid, void *buf, UINT16 len); | ||
2859 | int | ||
2860 | hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable); | ||
2861 | int | ||
2862 | hfa384x_cmd_download( | ||
2863 | hfa384x_t *hw, | ||
2864 | UINT16 mode, | ||
2865 | UINT16 lowaddr, | ||
2866 | UINT16 highaddr, | ||
2867 | UINT16 codelen); | ||
2868 | int | ||
2869 | hfa384x_cmd_aux_enable(hfa384x_t *hw, int force); | ||
2870 | int | ||
2871 | hfa384x_cmd_aux_disable(hfa384x_t *hw); | ||
2872 | int | ||
2873 | hfa384x_copy_from_bap( | ||
2874 | hfa384x_t *hw, | ||
2875 | UINT16 bap, | ||
2876 | UINT16 id, | ||
2877 | UINT16 offset, | ||
2878 | void *buf, | ||
2879 | UINT len); | ||
2880 | int | ||
2881 | hfa384x_copy_to_bap( | ||
2882 | hfa384x_t *hw, | ||
2883 | UINT16 bap, | ||
2884 | UINT16 id, | ||
2885 | UINT16 offset, | ||
2886 | void *buf, | ||
2887 | UINT len); | ||
2888 | void | ||
2889 | hfa384x_copy_from_aux( | ||
2890 | hfa384x_t *hw, | ||
2891 | UINT32 cardaddr, | ||
2892 | UINT32 auxctl, | ||
2893 | void *buf, | ||
2894 | UINT len); | ||
2895 | void | ||
2896 | hfa384x_copy_to_aux( | ||
2897 | hfa384x_t *hw, | ||
2898 | UINT32 cardaddr, | ||
2899 | UINT32 auxctl, | ||
2900 | void *buf, | ||
2901 | UINT len); | ||
2902 | |||
2903 | #if (WLAN_HOSTIF != WLAN_USB) | ||
2904 | |||
2905 | /* | ||
2906 | HFA384x is a LITTLE ENDIAN part. | ||
2907 | |||
2908 | the get/setreg functions implicitly byte-swap the data to LE. | ||
2909 | the _noswap variants do not perform a byte-swap on the data. | ||
2910 | */ | ||
2911 | |||
2912 | static inline UINT16 | ||
2913 | __hfa384x_getreg(hfa384x_t *hw, UINT reg); | ||
2914 | |||
2915 | static inline void | ||
2916 | __hfa384x_setreg(hfa384x_t *hw, UINT16 val, UINT reg); | ||
2917 | |||
2918 | static inline UINT16 | ||
2919 | __hfa384x_getreg_noswap(hfa384x_t *hw, UINT reg); | ||
2920 | |||
2921 | static inline void | ||
2922 | __hfa384x_setreg_noswap(hfa384x_t *hw, UINT16 val, UINT reg); | ||
2923 | |||
2924 | #ifdef REVERSE_ENDIAN | ||
2925 | #define hfa384x_getreg __hfa384x_getreg_noswap | ||
2926 | #define hfa384x_setreg __hfa384x_setreg_noswap | ||
2927 | #define hfa384x_getreg_noswap __hfa384x_getreg | ||
2928 | #define hfa384x_setreg_noswap __hfa384x_setreg | ||
2929 | #else | ||
2930 | #define hfa384x_getreg __hfa384x_getreg | ||
2931 | #define hfa384x_setreg __hfa384x_setreg | ||
2932 | #define hfa384x_getreg_noswap __hfa384x_getreg_noswap | ||
2933 | #define hfa384x_setreg_noswap __hfa384x_setreg_noswap | ||
2934 | #endif | ||
2935 | |||
2936 | /*---------------------------------------------------------------- | ||
2937 | * hfa384x_getreg | ||
2938 | * | ||
2939 | * Retrieve the value of one of the MAC registers. Done here | ||
2940 | * because different PRISM2 MAC parts use different buses and such. | ||
2941 | * NOTE: This function returns the value in HOST ORDER!!!!!! | ||
2942 | * | ||
2943 | * Arguments: | ||
2944 | * hw MAC part structure | ||
2945 | * reg Register identifier (offset for I/O based i/f) | ||
2946 | * | ||
2947 | * Returns: | ||
2948 | * Value from the register in HOST ORDER!!!! | ||
2949 | ----------------------------------------------------------------*/ | ||
2950 | static inline UINT16 | ||
2951 | __hfa384x_getreg(hfa384x_t *hw, UINT reg) | ||
2952 | { | ||
2953 | /* printk(KERN_DEBUG "Reading from 0x%0x\n", hw->membase + reg); */ | ||
2954 | #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) | ||
2955 | return wlan_inw_le16_to_cpu(hw->iobase+reg); | ||
2956 | #elif (WLAN_HOSTIF == WLAN_PCI) | ||
2957 | return __le16_to_cpu(readw(hw->membase + reg)); | ||
2958 | #endif | ||
2959 | } | ||
2960 | |||
2961 | /*---------------------------------------------------------------- | ||
2962 | * hfa384x_setreg | ||
2963 | * | ||
2964 | * Set the value of one of the MAC registers. Done here | ||
2965 | * because different PRISM2 MAC parts use different buses and such. | ||
2966 | * NOTE: This function assumes the value is in HOST ORDER!!!!!! | ||
2967 | * | ||
2968 | * Arguments: | ||
2969 | * hw MAC part structure | ||
2970 | * val Value, in HOST ORDER!!, to put in the register | ||
2971 | * reg Register identifier (offset for I/O based i/f) | ||
2972 | * | ||
2973 | * Returns: | ||
2974 | * Nothing | ||
2975 | ----------------------------------------------------------------*/ | ||
2976 | static inline void | ||
2977 | __hfa384x_setreg(hfa384x_t *hw, UINT16 val, UINT reg) | ||
2978 | { | ||
2979 | #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) | ||
2980 | wlan_outw_cpu_to_le16( val, hw->iobase + reg); | ||
2981 | return; | ||
2982 | #elif (WLAN_HOSTIF == WLAN_PCI) | ||
2983 | writew(__cpu_to_le16(val), hw->membase + reg); | ||
2984 | return; | ||
2985 | #endif | ||
2986 | } | ||
2987 | |||
2988 | |||
2989 | /*---------------------------------------------------------------- | ||
2990 | * hfa384x_getreg_noswap | ||
2991 | * | ||
2992 | * Retrieve the value of one of the MAC registers. Done here | ||
2993 | * because different PRISM2 MAC parts use different buses and such. | ||
2994 | * | ||
2995 | * Arguments: | ||
2996 | * hw MAC part structure | ||
2997 | * reg Register identifier (offset for I/O based i/f) | ||
2998 | * | ||
2999 | * Returns: | ||
3000 | * Value from the register. | ||
3001 | ----------------------------------------------------------------*/ | ||
3002 | static inline UINT16 | ||
3003 | __hfa384x_getreg_noswap(hfa384x_t *hw, UINT reg) | ||
3004 | { | ||
3005 | #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) | ||
3006 | return wlan_inw(hw->iobase+reg); | ||
3007 | #elif (WLAN_HOSTIF == WLAN_PCI) | ||
3008 | return readw(hw->membase + reg); | ||
3009 | #endif | ||
3010 | } | ||
3011 | |||
3012 | |||
3013 | /*---------------------------------------------------------------- | ||
3014 | * hfa384x_setreg_noswap | ||
3015 | * | ||
3016 | * Set the value of one of the MAC registers. Done here | ||
3017 | * because different PRISM2 MAC parts use different buses and such. | ||
3018 | * | ||
3019 | * Arguments: | ||
3020 | * hw MAC part structure | ||
3021 | * val Value to put in the register | ||
3022 | * reg Register identifier (offset for I/O based i/f) | ||
3023 | * | ||
3024 | * Returns: | ||
3025 | * Nothing | ||
3026 | ----------------------------------------------------------------*/ | ||
3027 | static inline void | ||
3028 | __hfa384x_setreg_noswap(hfa384x_t *hw, UINT16 val, UINT reg) | ||
3029 | { | ||
3030 | #if ((WLAN_HOSTIF == WLAN_PCMCIA) || (WLAN_HOSTIF == WLAN_PLX)) | ||
3031 | wlan_outw( val, hw->iobase + reg); | ||
3032 | return; | ||
3033 | #elif (WLAN_HOSTIF == WLAN_PCI) | ||
3034 | writew(val, hw->membase + reg); | ||
3035 | return; | ||
3036 | #endif | ||
3037 | } | ||
3038 | |||
3039 | |||
3040 | static inline void hfa384x_events_all(hfa384x_t *hw) | ||
3041 | { | ||
3042 | hfa384x_setreg(hw, | ||
3043 | HFA384x_INT_NORMAL | ||
3044 | #ifdef CMD_IRQ | ||
3045 | | HFA384x_INTEN_CMD_SET(1) | ||
3046 | #endif | ||
3047 | , | ||
3048 | HFA384x_INTEN); | ||
3049 | |||
3050 | } | ||
3051 | |||
3052 | static inline void hfa384x_events_nobap(hfa384x_t *hw) | ||
3053 | { | ||
3054 | hfa384x_setreg(hw, | ||
3055 | (HFA384x_INT_NORMAL & ~HFA384x_INT_BAP_OP) | ||
3056 | #ifdef CMD_IRQ | ||
3057 | | HFA384x_INTEN_CMD_SET(1) | ||
3058 | #endif | ||
3059 | , | ||
3060 | HFA384x_INTEN); | ||
3061 | |||
3062 | } | ||
3063 | |||
3064 | #endif /* WLAN_HOSTIF != WLAN_USB */ | ||
3065 | #endif /* __KERNEL__ */ | ||
3066 | |||
3067 | #endif /* _HFA384x_H */ | ||
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c new file mode 100644 index 000000000000..db0c502f5d90 --- /dev/null +++ b/drivers/staging/wlan-ng/hfa384x_usb.c | |||
@@ -0,0 +1,5027 @@ | |||
1 | /* src/prism2/driver/hfa384x_usb.c | ||
2 | * | ||
3 | * Functions that talk to the USB variantof the Intersil hfa384x MAC | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file implements functions that correspond to the prism2/hfa384x | ||
48 | * 802.11 MAC hardware and firmware host interface. | ||
49 | * | ||
50 | * The functions can be considered to represent several levels of | ||
51 | * abstraction. The lowest level functions are simply C-callable wrappers | ||
52 | * around the register accesses. The next higher level represents C-callable | ||
53 | * prism2 API functions that match the Intersil documentation as closely | ||
54 | * as is reasonable. The next higher layer implements common sequences | ||
55 | * of invokations of the API layer (e.g. write to bap, followed by cmd). | ||
56 | * | ||
57 | * Common sequences: | ||
58 | * hfa384x_drvr_xxx Highest level abstractions provided by the | ||
59 | * hfa384x code. They are driver defined wrappers | ||
60 | * for common sequences. These functions generally | ||
61 | * use the services of the lower levels. | ||
62 | * | ||
63 | * hfa384x_drvr_xxxconfig An example of the drvr level abstraction. These | ||
64 | * functions are wrappers for the RID get/set | ||
65 | * sequence. They call copy_[to|from]_bap() and | ||
66 | * cmd_access(). These functions operate on the | ||
67 | * RIDs and buffers without validation. The caller | ||
68 | * is responsible for that. | ||
69 | * | ||
70 | * API wrapper functions: | ||
71 | * hfa384x_cmd_xxx functions that provide access to the f/w commands. | ||
72 | * The function arguments correspond to each command | ||
73 | * argument, even command arguments that get packed | ||
74 | * into single registers. These functions _just_ | ||
75 | * issue the command by setting the cmd/parm regs | ||
76 | * & reading the status/resp regs. Additional | ||
77 | * activities required to fully use a command | ||
78 | * (read/write from/to bap, get/set int status etc.) | ||
79 | * are implemented separately. Think of these as | ||
80 | * C-callable prism2 commands. | ||
81 | * | ||
82 | * Lowest Layer Functions: | ||
83 | * hfa384x_docmd_xxx These functions implement the sequence required | ||
84 | * to issue any prism2 command. Primarily used by the | ||
85 | * hfa384x_cmd_xxx functions. | ||
86 | * | ||
87 | * hfa384x_bap_xxx BAP read/write access functions. | ||
88 | * Note: we usually use BAP0 for non-interrupt context | ||
89 | * and BAP1 for interrupt context. | ||
90 | * | ||
91 | * hfa384x_dl_xxx download related functions. | ||
92 | * | ||
93 | * Driver State Issues: | ||
94 | * Note that there are two pairs of functions that manage the | ||
95 | * 'initialized' and 'running' states of the hw/MAC combo. The four | ||
96 | * functions are create(), destroy(), start(), and stop(). create() | ||
97 | * sets up the data structures required to support the hfa384x_* | ||
98 | * functions and destroy() cleans them up. The start() function gets | ||
99 | * the actual hardware running and enables the interrupts. The stop() | ||
100 | * function shuts the hardware down. The sequence should be: | ||
101 | * create() | ||
102 | * start() | ||
103 | * . | ||
104 | * . Do interesting things w/ the hardware | ||
105 | * . | ||
106 | * stop() | ||
107 | * destroy() | ||
108 | * | ||
109 | * Note that destroy() can be called without calling stop() first. | ||
110 | * -------------------------------------------------------------------- | ||
111 | */ | ||
112 | |||
113 | /*================================================================*/ | ||
114 | /* System Includes */ | ||
115 | #define WLAN_DBVAR prism2_debug | ||
116 | |||
117 | #include "version.h" | ||
118 | |||
119 | |||
120 | #include <linux/version.h> | ||
121 | |||
122 | #include <linux/module.h> | ||
123 | #include <linux/kernel.h> | ||
124 | #include <linux/sched.h> | ||
125 | #include <linux/types.h> | ||
126 | #include <linux/slab.h> | ||
127 | #include <linux/wireless.h> | ||
128 | #include <linux/netdevice.h> | ||
129 | #include <linux/timer.h> | ||
130 | #include <asm/io.h> | ||
131 | #include <linux/delay.h> | ||
132 | #include <asm/byteorder.h> | ||
133 | #include <asm/bitops.h> | ||
134 | #include <linux/list.h> | ||
135 | #include <linux/usb.h> | ||
136 | |||
137 | #include "wlan_compat.h" | ||
138 | |||
139 | #if (WLAN_HOSTIF != WLAN_USB) | ||
140 | #error "This file is specific to USB" | ||
141 | #endif | ||
142 | |||
143 | |||
144 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) | ||
145 | static int | ||
146 | wait_for_completion_interruptible(struct completion *x) | ||
147 | { | ||
148 | int ret = 0; | ||
149 | |||
150 | might_sleep(); | ||
151 | |||
152 | spin_lock_irq(&x->wait.lock); | ||
153 | if (!x->done) { | ||
154 | DECLARE_WAITQUEUE(wait, current); | ||
155 | |||
156 | wait.flags |= WQ_FLAG_EXCLUSIVE; | ||
157 | __add_wait_queue_tail(&x->wait, &wait); | ||
158 | do { | ||
159 | if (signal_pending(current)) { | ||
160 | ret = -ERESTARTSYS; | ||
161 | __remove_wait_queue(&x->wait, &wait); | ||
162 | goto out; | ||
163 | } | ||
164 | __set_current_state(TASK_INTERRUPTIBLE); | ||
165 | spin_unlock_irq(&x->wait.lock); | ||
166 | schedule(); | ||
167 | spin_lock_irq(&x->wait.lock); | ||
168 | } while (!x->done); | ||
169 | __remove_wait_queue(&x->wait, &wait); | ||
170 | } | ||
171 | x->done--; | ||
172 | out: | ||
173 | spin_unlock_irq(&x->wait.lock); | ||
174 | |||
175 | return ret; | ||
176 | } | ||
177 | #endif | ||
178 | |||
179 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,69) | ||
180 | static void | ||
181 | usb_init_urb(struct urb *urb) | ||
182 | { | ||
183 | memset(urb, 0, sizeof(*urb)); | ||
184 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */ | ||
185 | urb->count = (atomic_t)ATOMIC_INIT(1); | ||
186 | #endif | ||
187 | spin_lock_init(&urb->lock); | ||
188 | } | ||
189 | #endif | ||
190 | |||
191 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* tune me! */ | ||
192 | # define SUBMIT_URB(u,f) usb_submit_urb(u,f) | ||
193 | #else | ||
194 | # define SUBMIT_URB(u,f) usb_submit_urb(u) | ||
195 | #endif | ||
196 | |||
197 | /*================================================================*/ | ||
198 | /* Project Includes */ | ||
199 | |||
200 | #include "p80211types.h" | ||
201 | #include "p80211hdr.h" | ||
202 | #include "p80211mgmt.h" | ||
203 | #include "p80211conv.h" | ||
204 | #include "p80211msg.h" | ||
205 | #include "p80211netdev.h" | ||
206 | #include "p80211req.h" | ||
207 | #include "p80211metadef.h" | ||
208 | #include "p80211metastruct.h" | ||
209 | #include "hfa384x.h" | ||
210 | #include "prism2mgmt.h" | ||
211 | |||
212 | /*================================================================*/ | ||
213 | /* Local Constants */ | ||
214 | |||
215 | enum cmd_mode | ||
216 | { | ||
217 | DOWAIT = 0, | ||
218 | DOASYNC | ||
219 | }; | ||
220 | typedef enum cmd_mode CMD_MODE; | ||
221 | |||
222 | #define THROTTLE_JIFFIES (HZ/8) | ||
223 | |||
224 | /*================================================================*/ | ||
225 | /* Local Macros */ | ||
226 | |||
227 | #define ROUNDUP64(a) (((a)+63)&~63) | ||
228 | |||
229 | /*================================================================*/ | ||
230 | /* Local Types */ | ||
231 | |||
232 | /*================================================================*/ | ||
233 | /* Local Static Definitions */ | ||
234 | extern int prism2_debug; | ||
235 | |||
236 | /*================================================================*/ | ||
237 | /* Local Function Declarations */ | ||
238 | |||
239 | #ifdef DEBUG_USB | ||
240 | static void | ||
241 | dbprint_urb(struct urb* urb); | ||
242 | #endif | ||
243 | |||
244 | static void | ||
245 | hfa384x_int_rxmonitor( | ||
246 | wlandevice_t *wlandev, | ||
247 | hfa384x_usb_rxfrm_t *rxfrm); | ||
248 | |||
249 | static void | ||
250 | hfa384x_usb_defer(struct work_struct *data); | ||
251 | |||
252 | static int | ||
253 | submit_rx_urb(hfa384x_t *hw, gfp_t flags); | ||
254 | |||
255 | static int | ||
256 | submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t flags); | ||
257 | |||
258 | /*---------------------------------------------------*/ | ||
259 | /* Callbacks */ | ||
260 | #ifdef URB_ONLY_CALLBACK | ||
261 | static void | ||
262 | hfa384x_usbout_callback(struct urb *urb); | ||
263 | static void | ||
264 | hfa384x_ctlxout_callback(struct urb *urb); | ||
265 | static void | ||
266 | hfa384x_usbin_callback(struct urb *urb); | ||
267 | #else | ||
268 | static void | ||
269 | hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs); | ||
270 | static void | ||
271 | hfa384x_ctlxout_callback(struct urb *urb, struct pt_regs *regs); | ||
272 | static void | ||
273 | hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs); | ||
274 | #endif | ||
275 | |||
276 | static void | ||
277 | hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin); | ||
278 | |||
279 | static void | ||
280 | hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb); | ||
281 | |||
282 | static void | ||
283 | hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin); | ||
284 | |||
285 | static void | ||
286 | hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout); | ||
287 | |||
288 | static void hfa384x_usbin_ctlx(hfa384x_t *hw, hfa384x_usbin_t *usbin, | ||
289 | int urb_status); | ||
290 | |||
291 | /*---------------------------------------------------*/ | ||
292 | /* Functions to support the prism2 usb command queue */ | ||
293 | |||
294 | static void | ||
295 | hfa384x_usbctlxq_run(hfa384x_t *hw); | ||
296 | |||
297 | static void | ||
298 | hfa384x_usbctlx_reqtimerfn(unsigned long data); | ||
299 | |||
300 | static void | ||
301 | hfa384x_usbctlx_resptimerfn(unsigned long data); | ||
302 | |||
303 | static void | ||
304 | hfa384x_usb_throttlefn(unsigned long data); | ||
305 | |||
306 | static void | ||
307 | hfa384x_usbctlx_completion_task(unsigned long data); | ||
308 | |||
309 | static void | ||
310 | hfa384x_usbctlx_reaper_task(unsigned long data); | ||
311 | |||
312 | static int | ||
313 | hfa384x_usbctlx_submit(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); | ||
314 | |||
315 | static void | ||
316 | unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); | ||
317 | |||
318 | struct usbctlx_completor | ||
319 | { | ||
320 | int (*complete)(struct usbctlx_completor*); | ||
321 | }; | ||
322 | typedef struct usbctlx_completor usbctlx_completor_t; | ||
323 | |||
324 | static int | ||
325 | hfa384x_usbctlx_complete_sync(hfa384x_t *hw, | ||
326 | hfa384x_usbctlx_t *ctlx, | ||
327 | usbctlx_completor_t *completor); | ||
328 | |||
329 | static int | ||
330 | unlocked_usbctlx_cancel_async(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); | ||
331 | |||
332 | static void | ||
333 | hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx); | ||
334 | |||
335 | static void | ||
336 | hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx); | ||
337 | |||
338 | static int | ||
339 | usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp, | ||
340 | hfa384x_cmdresult_t *result); | ||
341 | |||
342 | static void | ||
343 | usbctlx_get_rridresult(const hfa384x_usb_rridresp_t *rridresp, | ||
344 | hfa384x_rridresult_t *result); | ||
345 | |||
346 | /*---------------------------------------------------*/ | ||
347 | /* Low level req/resp CTLX formatters and submitters */ | ||
348 | static int | ||
349 | hfa384x_docmd( | ||
350 | hfa384x_t *hw, | ||
351 | CMD_MODE mode, | ||
352 | hfa384x_metacmd_t *cmd, | ||
353 | ctlx_cmdcb_t cmdcb, | ||
354 | ctlx_usercb_t usercb, | ||
355 | void *usercb_data); | ||
356 | |||
357 | static int | ||
358 | hfa384x_dorrid( | ||
359 | hfa384x_t *hw, | ||
360 | CMD_MODE mode, | ||
361 | UINT16 rid, | ||
362 | void *riddata, | ||
363 | UINT riddatalen, | ||
364 | ctlx_cmdcb_t cmdcb, | ||
365 | ctlx_usercb_t usercb, | ||
366 | void *usercb_data); | ||
367 | |||
368 | static int | ||
369 | hfa384x_dowrid( | ||
370 | hfa384x_t *hw, | ||
371 | CMD_MODE mode, | ||
372 | UINT16 rid, | ||
373 | void *riddata, | ||
374 | UINT riddatalen, | ||
375 | ctlx_cmdcb_t cmdcb, | ||
376 | ctlx_usercb_t usercb, | ||
377 | void *usercb_data); | ||
378 | |||
379 | static int | ||
380 | hfa384x_dormem( | ||
381 | hfa384x_t *hw, | ||
382 | CMD_MODE mode, | ||
383 | UINT16 page, | ||
384 | UINT16 offset, | ||
385 | void *data, | ||
386 | UINT len, | ||
387 | ctlx_cmdcb_t cmdcb, | ||
388 | ctlx_usercb_t usercb, | ||
389 | void *usercb_data); | ||
390 | |||
391 | static int | ||
392 | hfa384x_dowmem( | ||
393 | hfa384x_t *hw, | ||
394 | CMD_MODE mode, | ||
395 | UINT16 page, | ||
396 | UINT16 offset, | ||
397 | void *data, | ||
398 | UINT len, | ||
399 | ctlx_cmdcb_t cmdcb, | ||
400 | ctlx_usercb_t usercb, | ||
401 | void *usercb_data); | ||
402 | |||
403 | static int | ||
404 | hfa384x_isgood_pdrcode(UINT16 pdrcode); | ||
405 | |||
406 | /*================================================================*/ | ||
407 | /* Function Definitions */ | ||
408 | static inline const char* ctlxstr(CTLX_STATE s) | ||
409 | { | ||
410 | static const char* ctlx_str[] = { | ||
411 | "Initial state", | ||
412 | "Complete", | ||
413 | "Request failed", | ||
414 | "Request pending", | ||
415 | "Request packet submitted", | ||
416 | "Request packet completed", | ||
417 | "Response packet completed" | ||
418 | }; | ||
419 | |||
420 | return ctlx_str[s]; | ||
421 | }; | ||
422 | |||
423 | |||
424 | static inline hfa384x_usbctlx_t* | ||
425 | get_active_ctlx(hfa384x_t *hw) | ||
426 | { | ||
427 | return list_entry(hw->ctlxq.active.next, hfa384x_usbctlx_t, list); | ||
428 | } | ||
429 | |||
430 | |||
431 | #ifdef DEBUG_USB | ||
432 | void | ||
433 | dbprint_urb(struct urb* urb) | ||
434 | { | ||
435 | WLAN_LOG_DEBUG(3,"urb->pipe=0x%08x\n", urb->pipe); | ||
436 | WLAN_LOG_DEBUG(3,"urb->status=0x%08x\n", urb->status); | ||
437 | WLAN_LOG_DEBUG(3,"urb->transfer_flags=0x%08x\n", urb->transfer_flags); | ||
438 | WLAN_LOG_DEBUG(3,"urb->transfer_buffer=0x%08x\n", (UINT)urb->transfer_buffer); | ||
439 | WLAN_LOG_DEBUG(3,"urb->transfer_buffer_length=0x%08x\n", urb->transfer_buffer_length); | ||
440 | WLAN_LOG_DEBUG(3,"urb->actual_length=0x%08x\n", urb->actual_length); | ||
441 | WLAN_LOG_DEBUG(3,"urb->bandwidth=0x%08x\n", urb->bandwidth); | ||
442 | WLAN_LOG_DEBUG(3,"urb->setup_packet(ctl)=0x%08x\n", (UINT)urb->setup_packet); | ||
443 | WLAN_LOG_DEBUG(3,"urb->start_frame(iso/irq)=0x%08x\n", urb->start_frame); | ||
444 | WLAN_LOG_DEBUG(3,"urb->interval(irq)=0x%08x\n", urb->interval); | ||
445 | WLAN_LOG_DEBUG(3,"urb->error_count(iso)=0x%08x\n", urb->error_count); | ||
446 | WLAN_LOG_DEBUG(3,"urb->timeout=0x%08x\n", urb->timeout); | ||
447 | WLAN_LOG_DEBUG(3,"urb->context=0x%08x\n", (UINT)urb->context); | ||
448 | WLAN_LOG_DEBUG(3,"urb->complete=0x%08x\n", (UINT)urb->complete); | ||
449 | } | ||
450 | #endif | ||
451 | |||
452 | |||
453 | /*---------------------------------------------------------------- | ||
454 | * submit_rx_urb | ||
455 | * | ||
456 | * Listen for input data on the BULK-IN pipe. If the pipe has | ||
457 | * stalled then schedule it to be reset. | ||
458 | * | ||
459 | * Arguments: | ||
460 | * hw device struct | ||
461 | * memflags memory allocation flags | ||
462 | * | ||
463 | * Returns: | ||
464 | * error code from submission | ||
465 | * | ||
466 | * Call context: | ||
467 | * Any | ||
468 | ----------------------------------------------------------------*/ | ||
469 | static int | ||
470 | submit_rx_urb(hfa384x_t *hw, gfp_t memflags) | ||
471 | { | ||
472 | struct sk_buff *skb; | ||
473 | int result; | ||
474 | |||
475 | DBFENTER; | ||
476 | |||
477 | skb = dev_alloc_skb(sizeof(hfa384x_usbin_t)); | ||
478 | if (skb == NULL) { | ||
479 | result = -ENOMEM; | ||
480 | goto done; | ||
481 | } | ||
482 | |||
483 | /* Post the IN urb */ | ||
484 | usb_fill_bulk_urb(&hw->rx_urb, hw->usb, | ||
485 | hw->endp_in, | ||
486 | skb->data, sizeof(hfa384x_usbin_t), | ||
487 | hfa384x_usbin_callback, hw->wlandev); | ||
488 | |||
489 | hw->rx_urb_skb = skb; | ||
490 | |||
491 | result = -ENOLINK; | ||
492 | if ( !hw->wlandev->hwremoved && !test_bit(WORK_RX_HALT, &hw->usb_flags)) { | ||
493 | result = SUBMIT_URB(&hw->rx_urb, memflags); | ||
494 | |||
495 | /* Check whether we need to reset the RX pipe */ | ||
496 | if (result == -EPIPE) { | ||
497 | WLAN_LOG_WARNING("%s rx pipe stalled: requesting reset\n", | ||
498 | hw->wlandev->netdev->name); | ||
499 | if ( !test_and_set_bit(WORK_RX_HALT, &hw->usb_flags) ) | ||
500 | schedule_work(&hw->usb_work); | ||
501 | } | ||
502 | } | ||
503 | |||
504 | /* Don't leak memory if anything should go wrong */ | ||
505 | if (result != 0) { | ||
506 | dev_kfree_skb(skb); | ||
507 | hw->rx_urb_skb = NULL; | ||
508 | } | ||
509 | |||
510 | done: | ||
511 | |||
512 | DBFEXIT; | ||
513 | return result; | ||
514 | } | ||
515 | |||
516 | /*---------------------------------------------------------------- | ||
517 | * submit_tx_urb | ||
518 | * | ||
519 | * Prepares and submits the URB of transmitted data. If the | ||
520 | * submission fails then it will schedule the output pipe to | ||
521 | * be reset. | ||
522 | * | ||
523 | * Arguments: | ||
524 | * hw device struct | ||
525 | * tx_urb URB of data for tranmission | ||
526 | * memflags memory allocation flags | ||
527 | * | ||
528 | * Returns: | ||
529 | * error code from submission | ||
530 | * | ||
531 | * Call context: | ||
532 | * Any | ||
533 | ----------------------------------------------------------------*/ | ||
534 | static int | ||
535 | submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags) | ||
536 | { | ||
537 | struct net_device *netdev = hw->wlandev->netdev; | ||
538 | int result; | ||
539 | |||
540 | DBFENTER; | ||
541 | |||
542 | result = -ENOLINK; | ||
543 | if ( netif_running(netdev) ) { | ||
544 | |||
545 | if ( !hw->wlandev->hwremoved && !test_bit(WORK_TX_HALT, &hw->usb_flags) ) { | ||
546 | result = SUBMIT_URB(tx_urb, memflags); | ||
547 | |||
548 | /* Test whether we need to reset the TX pipe */ | ||
549 | if (result == -EPIPE) { | ||
550 | WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n", | ||
551 | netdev->name); | ||
552 | set_bit(WORK_TX_HALT, &hw->usb_flags); | ||
553 | schedule_work(&hw->usb_work); | ||
554 | } else if (result == 0) { | ||
555 | netif_stop_queue(netdev); | ||
556 | } | ||
557 | } | ||
558 | } | ||
559 | |||
560 | DBFEXIT; | ||
561 | |||
562 | return result; | ||
563 | } | ||
564 | |||
565 | /*---------------------------------------------------------------- | ||
566 | * hfa394x_usb_defer | ||
567 | * | ||
568 | * There are some things that the USB stack cannot do while | ||
569 | * in interrupt context, so we arrange this function to run | ||
570 | * in process context. | ||
571 | * | ||
572 | * Arguments: | ||
573 | * hw device structure | ||
574 | * | ||
575 | * Returns: | ||
576 | * nothing | ||
577 | * | ||
578 | * Call context: | ||
579 | * process (by design) | ||
580 | ----------------------------------------------------------------*/ | ||
581 | static void | ||
582 | hfa384x_usb_defer(struct work_struct *data) | ||
583 | { | ||
584 | hfa384x_t *hw = container_of(data, struct hfa384x, usb_work); | ||
585 | struct net_device *netdev = hw->wlandev->netdev; | ||
586 | |||
587 | DBFENTER; | ||
588 | |||
589 | /* Don't bother trying to reset anything if the plug | ||
590 | * has been pulled ... | ||
591 | */ | ||
592 | if ( hw->wlandev->hwremoved ) { | ||
593 | DBFEXIT; | ||
594 | return; | ||
595 | } | ||
596 | |||
597 | /* Reception has stopped: try to reset the input pipe */ | ||
598 | if (test_bit(WORK_RX_HALT, &hw->usb_flags)) { | ||
599 | int ret; | ||
600 | |||
601 | usb_kill_urb(&hw->rx_urb); /* Cannot be holding spinlock! */ | ||
602 | |||
603 | ret = usb_clear_halt(hw->usb, hw->endp_in); | ||
604 | if (ret != 0) { | ||
605 | printk(KERN_ERR | ||
606 | "Failed to clear rx pipe for %s: err=%d\n", | ||
607 | netdev->name, ret); | ||
608 | } else { | ||
609 | printk(KERN_INFO "%s rx pipe reset complete.\n", | ||
610 | netdev->name); | ||
611 | clear_bit(WORK_RX_HALT, &hw->usb_flags); | ||
612 | set_bit(WORK_RX_RESUME, &hw->usb_flags); | ||
613 | } | ||
614 | } | ||
615 | |||
616 | /* Resume receiving data back from the device. */ | ||
617 | if ( test_bit(WORK_RX_RESUME, &hw->usb_flags) ) { | ||
618 | int ret; | ||
619 | |||
620 | ret = submit_rx_urb(hw, GFP_KERNEL); | ||
621 | if (ret != 0) { | ||
622 | printk(KERN_ERR | ||
623 | "Failed to resume %s rx pipe.\n", netdev->name); | ||
624 | } else { | ||
625 | clear_bit(WORK_RX_RESUME, &hw->usb_flags); | ||
626 | } | ||
627 | } | ||
628 | |||
629 | /* Transmission has stopped: try to reset the output pipe */ | ||
630 | if (test_bit(WORK_TX_HALT, &hw->usb_flags)) { | ||
631 | int ret; | ||
632 | |||
633 | usb_kill_urb(&hw->tx_urb); | ||
634 | ret = usb_clear_halt(hw->usb, hw->endp_out); | ||
635 | if (ret != 0) { | ||
636 | printk(KERN_ERR | ||
637 | "Failed to clear tx pipe for %s: err=%d\n", | ||
638 | netdev->name, ret); | ||
639 | } else { | ||
640 | printk(KERN_INFO "%s tx pipe reset complete.\n", | ||
641 | netdev->name); | ||
642 | clear_bit(WORK_TX_HALT, &hw->usb_flags); | ||
643 | set_bit(WORK_TX_RESUME, &hw->usb_flags); | ||
644 | |||
645 | /* Stopping the BULK-OUT pipe also blocked | ||
646 | * us from sending any more CTLX URBs, so | ||
647 | * we need to re-run our queue ... | ||
648 | */ | ||
649 | hfa384x_usbctlxq_run(hw); | ||
650 | } | ||
651 | } | ||
652 | |||
653 | /* Resume transmitting. */ | ||
654 | if ( test_and_clear_bit(WORK_TX_RESUME, &hw->usb_flags) ) { | ||
655 | p80211netdev_wake_queue(hw->wlandev); | ||
656 | } | ||
657 | |||
658 | DBFEXIT; | ||
659 | } | ||
660 | |||
661 | |||
662 | /*---------------------------------------------------------------- | ||
663 | * hfa384x_create | ||
664 | * | ||
665 | * Sets up the hfa384x_t data structure for use. Note this | ||
666 | * does _not_ intialize the actual hardware, just the data structures | ||
667 | * we use to keep track of its state. | ||
668 | * | ||
669 | * Arguments: | ||
670 | * hw device structure | ||
671 | * irq device irq number | ||
672 | * iobase i/o base address for register access | ||
673 | * membase memory base address for register access | ||
674 | * | ||
675 | * Returns: | ||
676 | * nothing | ||
677 | * | ||
678 | * Side effects: | ||
679 | * | ||
680 | * Call context: | ||
681 | * process | ||
682 | ----------------------------------------------------------------*/ | ||
683 | void | ||
684 | hfa384x_create( hfa384x_t *hw, struct usb_device *usb) | ||
685 | { | ||
686 | DBFENTER; | ||
687 | |||
688 | memset(hw, 0, sizeof(hfa384x_t)); | ||
689 | hw->usb = usb; | ||
690 | |||
691 | /* set up the endpoints */ | ||
692 | hw->endp_in = usb_rcvbulkpipe(usb, 1); | ||
693 | hw->endp_out = usb_sndbulkpipe(usb, 2); | ||
694 | |||
695 | /* Set up the waitq */ | ||
696 | init_waitqueue_head(&hw->cmdq); | ||
697 | |||
698 | /* Initialize the command queue */ | ||
699 | spin_lock_init(&hw->ctlxq.lock); | ||
700 | INIT_LIST_HEAD(&hw->ctlxq.pending); | ||
701 | INIT_LIST_HEAD(&hw->ctlxq.active); | ||
702 | INIT_LIST_HEAD(&hw->ctlxq.completing); | ||
703 | INIT_LIST_HEAD(&hw->ctlxq.reapable); | ||
704 | |||
705 | /* Initialize the authentication queue */ | ||
706 | skb_queue_head_init(&hw->authq); | ||
707 | |||
708 | tasklet_init(&hw->reaper_bh, | ||
709 | hfa384x_usbctlx_reaper_task, | ||
710 | (unsigned long)hw); | ||
711 | tasklet_init(&hw->completion_bh, | ||
712 | hfa384x_usbctlx_completion_task, | ||
713 | (unsigned long)hw); | ||
714 | INIT_WORK2(&hw->link_bh, prism2sta_processing_defer); | ||
715 | INIT_WORK2(&hw->usb_work, hfa384x_usb_defer); | ||
716 | |||
717 | init_timer(&hw->throttle); | ||
718 | hw->throttle.function = hfa384x_usb_throttlefn; | ||
719 | hw->throttle.data = (unsigned long)hw; | ||
720 | |||
721 | init_timer(&hw->resptimer); | ||
722 | hw->resptimer.function = hfa384x_usbctlx_resptimerfn; | ||
723 | hw->resptimer.data = (unsigned long)hw; | ||
724 | |||
725 | init_timer(&hw->reqtimer); | ||
726 | hw->reqtimer.function = hfa384x_usbctlx_reqtimerfn; | ||
727 | hw->reqtimer.data = (unsigned long)hw; | ||
728 | |||
729 | usb_init_urb(&hw->rx_urb); | ||
730 | usb_init_urb(&hw->tx_urb); | ||
731 | usb_init_urb(&hw->ctlx_urb); | ||
732 | |||
733 | hw->link_status = HFA384x_LINK_NOTCONNECTED; | ||
734 | hw->state = HFA384x_STATE_INIT; | ||
735 | |||
736 | INIT_WORK2(&hw->commsqual_bh, prism2sta_commsqual_defer); | ||
737 | init_timer(&hw->commsqual_timer); | ||
738 | hw->commsqual_timer.data = (unsigned long) hw; | ||
739 | hw->commsqual_timer.function = prism2sta_commsqual_timer; | ||
740 | |||
741 | DBFEXIT; | ||
742 | } | ||
743 | |||
744 | |||
745 | /*---------------------------------------------------------------- | ||
746 | * hfa384x_destroy | ||
747 | * | ||
748 | * Partner to hfa384x_create(). This function cleans up the hw | ||
749 | * structure so that it can be freed by the caller using a simple | ||
750 | * kfree. Currently, this function is just a placeholder. If, at some | ||
751 | * point in the future, an hw in the 'shutdown' state requires a 'deep' | ||
752 | * kfree, this is where it should be done. Note that if this function | ||
753 | * is called on a _running_ hw structure, the drvr_stop() function is | ||
754 | * called. | ||
755 | * | ||
756 | * Arguments: | ||
757 | * hw device structure | ||
758 | * | ||
759 | * Returns: | ||
760 | * nothing, this function is not allowed to fail. | ||
761 | * | ||
762 | * Side effects: | ||
763 | * | ||
764 | * Call context: | ||
765 | * process | ||
766 | ----------------------------------------------------------------*/ | ||
767 | void | ||
768 | hfa384x_destroy( hfa384x_t *hw) | ||
769 | { | ||
770 | struct sk_buff *skb; | ||
771 | |||
772 | DBFENTER; | ||
773 | |||
774 | if ( hw->state == HFA384x_STATE_RUNNING ) { | ||
775 | hfa384x_drvr_stop(hw); | ||
776 | } | ||
777 | hw->state = HFA384x_STATE_PREINIT; | ||
778 | |||
779 | if (hw->scanresults) { | ||
780 | kfree(hw->scanresults); | ||
781 | hw->scanresults = NULL; | ||
782 | } | ||
783 | |||
784 | /* Now to clean out the auth queue */ | ||
785 | while ( (skb = skb_dequeue(&hw->authq)) ) { | ||
786 | dev_kfree_skb(skb); | ||
787 | } | ||
788 | |||
789 | DBFEXIT; | ||
790 | } | ||
791 | |||
792 | |||
793 | /*---------------------------------------------------------------- | ||
794 | */ | ||
795 | static hfa384x_usbctlx_t* usbctlx_alloc(void) | ||
796 | { | ||
797 | hfa384x_usbctlx_t *ctlx; | ||
798 | |||
799 | ctlx = kmalloc(sizeof(*ctlx), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); | ||
800 | if (ctlx != NULL) | ||
801 | { | ||
802 | memset(ctlx, 0, sizeof(*ctlx)); | ||
803 | init_completion(&ctlx->done); | ||
804 | } | ||
805 | |||
806 | return ctlx; | ||
807 | } | ||
808 | |||
809 | |||
810 | /*---------------------------------------------------------------- | ||
811 | * | ||
812 | ----------------------------------------------------------------*/ | ||
813 | static int | ||
814 | usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp, | ||
815 | hfa384x_cmdresult_t *result) | ||
816 | { | ||
817 | DBFENTER; | ||
818 | |||
819 | result->status = hfa384x2host_16(cmdresp->status); | ||
820 | result->resp0 = hfa384x2host_16(cmdresp->resp0); | ||
821 | result->resp1 = hfa384x2host_16(cmdresp->resp1); | ||
822 | result->resp2 = hfa384x2host_16(cmdresp->resp2); | ||
823 | |||
824 | WLAN_LOG_DEBUG(4, "cmdresult:status=0x%04x " | ||
825 | "resp0=0x%04x resp1=0x%04x resp2=0x%04x\n", | ||
826 | result->status, | ||
827 | result->resp0, | ||
828 | result->resp1, | ||
829 | result->resp2); | ||
830 | |||
831 | DBFEXIT; | ||
832 | return (result->status & HFA384x_STATUS_RESULT); | ||
833 | } | ||
834 | |||
835 | static void | ||
836 | usbctlx_get_rridresult(const hfa384x_usb_rridresp_t *rridresp, | ||
837 | hfa384x_rridresult_t *result) | ||
838 | { | ||
839 | DBFENTER; | ||
840 | |||
841 | result->rid = hfa384x2host_16(rridresp->rid); | ||
842 | result->riddata = rridresp->data; | ||
843 | result->riddata_len = ((hfa384x2host_16(rridresp->frmlen) - 1) * 2); | ||
844 | |||
845 | DBFEXIT; | ||
846 | } | ||
847 | |||
848 | |||
849 | /*---------------------------------------------------------------- | ||
850 | * Completor object: | ||
851 | * This completor must be passed to hfa384x_usbctlx_complete_sync() | ||
852 | * when processing a CTLX that returns a hfa384x_cmdresult_t structure. | ||
853 | ----------------------------------------------------------------*/ | ||
854 | struct usbctlx_cmd_completor | ||
855 | { | ||
856 | usbctlx_completor_t head; | ||
857 | |||
858 | const hfa384x_usb_cmdresp_t *cmdresp; | ||
859 | hfa384x_cmdresult_t *result; | ||
860 | }; | ||
861 | typedef struct usbctlx_cmd_completor usbctlx_cmd_completor_t; | ||
862 | |||
863 | static int usbctlx_cmd_completor_fn(usbctlx_completor_t *head) | ||
864 | { | ||
865 | usbctlx_cmd_completor_t *complete = (usbctlx_cmd_completor_t*)head; | ||
866 | return usbctlx_get_status(complete->cmdresp, complete->result); | ||
867 | } | ||
868 | |||
869 | static inline usbctlx_completor_t* | ||
870 | init_cmd_completor(usbctlx_cmd_completor_t *completor, | ||
871 | const hfa384x_usb_cmdresp_t *cmdresp, | ||
872 | hfa384x_cmdresult_t *result) | ||
873 | { | ||
874 | completor->head.complete = usbctlx_cmd_completor_fn; | ||
875 | completor->cmdresp = cmdresp; | ||
876 | completor->result = result; | ||
877 | return &(completor->head); | ||
878 | } | ||
879 | |||
880 | /*---------------------------------------------------------------- | ||
881 | * Completor object: | ||
882 | * This completor must be passed to hfa384x_usbctlx_complete_sync() | ||
883 | * when processing a CTLX that reads a RID. | ||
884 | ----------------------------------------------------------------*/ | ||
885 | struct usbctlx_rrid_completor | ||
886 | { | ||
887 | usbctlx_completor_t head; | ||
888 | |||
889 | const hfa384x_usb_rridresp_t *rridresp; | ||
890 | void *riddata; | ||
891 | UINT riddatalen; | ||
892 | }; | ||
893 | typedef struct usbctlx_rrid_completor usbctlx_rrid_completor_t; | ||
894 | |||
895 | static int usbctlx_rrid_completor_fn(usbctlx_completor_t *head) | ||
896 | { | ||
897 | usbctlx_rrid_completor_t *complete = (usbctlx_rrid_completor_t*)head; | ||
898 | hfa384x_rridresult_t rridresult; | ||
899 | |||
900 | usbctlx_get_rridresult(complete->rridresp, &rridresult); | ||
901 | |||
902 | /* Validate the length, note body len calculation in bytes */ | ||
903 | if ( rridresult.riddata_len != complete->riddatalen ) { | ||
904 | WLAN_LOG_WARNING( | ||
905 | "RID len mismatch, rid=0x%04x hlen=%d fwlen=%d\n", | ||
906 | rridresult.rid, | ||
907 | complete->riddatalen, | ||
908 | rridresult.riddata_len); | ||
909 | return -ENODATA; | ||
910 | } | ||
911 | |||
912 | memcpy(complete->riddata, | ||
913 | rridresult.riddata, | ||
914 | complete->riddatalen); | ||
915 | return 0; | ||
916 | } | ||
917 | |||
918 | static inline usbctlx_completor_t* | ||
919 | init_rrid_completor(usbctlx_rrid_completor_t *completor, | ||
920 | const hfa384x_usb_rridresp_t *rridresp, | ||
921 | void *riddata, | ||
922 | UINT riddatalen) | ||
923 | { | ||
924 | completor->head.complete = usbctlx_rrid_completor_fn; | ||
925 | completor->rridresp = rridresp; | ||
926 | completor->riddata = riddata; | ||
927 | completor->riddatalen = riddatalen; | ||
928 | return &(completor->head); | ||
929 | } | ||
930 | |||
931 | /*---------------------------------------------------------------- | ||
932 | * Completor object: | ||
933 | * Interprets the results of a synchronous RID-write | ||
934 | ----------------------------------------------------------------*/ | ||
935 | typedef usbctlx_cmd_completor_t usbctlx_wrid_completor_t; | ||
936 | #define init_wrid_completor init_cmd_completor | ||
937 | |||
938 | /*---------------------------------------------------------------- | ||
939 | * Completor object: | ||
940 | * Interprets the results of a synchronous memory-write | ||
941 | ----------------------------------------------------------------*/ | ||
942 | typedef usbctlx_cmd_completor_t usbctlx_wmem_completor_t; | ||
943 | #define init_wmem_completor init_cmd_completor | ||
944 | |||
945 | /*---------------------------------------------------------------- | ||
946 | * Completor object: | ||
947 | * Interprets the results of a synchronous memory-read | ||
948 | ----------------------------------------------------------------*/ | ||
949 | struct usbctlx_rmem_completor | ||
950 | { | ||
951 | usbctlx_completor_t head; | ||
952 | |||
953 | const hfa384x_usb_rmemresp_t *rmemresp; | ||
954 | void *data; | ||
955 | UINT len; | ||
956 | }; | ||
957 | typedef struct usbctlx_rmem_completor usbctlx_rmem_completor_t; | ||
958 | |||
959 | static int usbctlx_rmem_completor_fn(usbctlx_completor_t *head) | ||
960 | { | ||
961 | usbctlx_rmem_completor_t *complete = (usbctlx_rmem_completor_t*)head; | ||
962 | |||
963 | WLAN_LOG_DEBUG(4,"rmemresp:len=%d\n", complete->rmemresp->frmlen); | ||
964 | memcpy(complete->data, complete->rmemresp->data, complete->len); | ||
965 | return 0; | ||
966 | } | ||
967 | |||
968 | static inline usbctlx_completor_t* | ||
969 | init_rmem_completor(usbctlx_rmem_completor_t *completor, | ||
970 | hfa384x_usb_rmemresp_t *rmemresp, | ||
971 | void *data, | ||
972 | UINT len) | ||
973 | { | ||
974 | completor->head.complete = usbctlx_rmem_completor_fn; | ||
975 | completor->rmemresp = rmemresp; | ||
976 | completor->data = data; | ||
977 | completor->len = len; | ||
978 | return &(completor->head); | ||
979 | } | ||
980 | |||
981 | /*---------------------------------------------------------------- | ||
982 | * hfa384x_cb_status | ||
983 | * | ||
984 | * Ctlx_complete handler for async CMD type control exchanges. | ||
985 | * mark the hw struct as such. | ||
986 | * | ||
987 | * Note: If the handling is changed here, it should probably be | ||
988 | * changed in docmd as well. | ||
989 | * | ||
990 | * Arguments: | ||
991 | * hw hw struct | ||
992 | * ctlx completed CTLX | ||
993 | * | ||
994 | * Returns: | ||
995 | * nothing | ||
996 | * | ||
997 | * Side effects: | ||
998 | * | ||
999 | * Call context: | ||
1000 | * interrupt | ||
1001 | ----------------------------------------------------------------*/ | ||
1002 | static void | ||
1003 | hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx) | ||
1004 | { | ||
1005 | DBFENTER; | ||
1006 | |||
1007 | if ( ctlx->usercb != NULL ) { | ||
1008 | hfa384x_cmdresult_t cmdresult; | ||
1009 | |||
1010 | if (ctlx->state != CTLX_COMPLETE) { | ||
1011 | memset(&cmdresult, 0, sizeof(cmdresult)); | ||
1012 | cmdresult.status = HFA384x_STATUS_RESULT_SET(HFA384x_CMD_ERR); | ||
1013 | } else { | ||
1014 | usbctlx_get_status(&ctlx->inbuf.cmdresp, &cmdresult); | ||
1015 | } | ||
1016 | |||
1017 | ctlx->usercb(hw, &cmdresult, ctlx->usercb_data); | ||
1018 | } | ||
1019 | |||
1020 | DBFEXIT; | ||
1021 | } | ||
1022 | |||
1023 | |||
1024 | /*---------------------------------------------------------------- | ||
1025 | * hfa384x_cb_rrid | ||
1026 | * | ||
1027 | * CTLX completion handler for async RRID type control exchanges. | ||
1028 | * | ||
1029 | * Note: If the handling is changed here, it should probably be | ||
1030 | * changed in dorrid as well. | ||
1031 | * | ||
1032 | * Arguments: | ||
1033 | * hw hw struct | ||
1034 | * ctlx completed CTLX | ||
1035 | * | ||
1036 | * Returns: | ||
1037 | * nothing | ||
1038 | * | ||
1039 | * Side effects: | ||
1040 | * | ||
1041 | * Call context: | ||
1042 | * interrupt | ||
1043 | ----------------------------------------------------------------*/ | ||
1044 | static void | ||
1045 | hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx) | ||
1046 | { | ||
1047 | DBFENTER; | ||
1048 | |||
1049 | if ( ctlx->usercb != NULL ) { | ||
1050 | hfa384x_rridresult_t rridresult; | ||
1051 | |||
1052 | if (ctlx->state != CTLX_COMPLETE) { | ||
1053 | memset(&rridresult, 0, sizeof(rridresult)); | ||
1054 | rridresult.rid = hfa384x2host_16(ctlx->outbuf.rridreq.rid); | ||
1055 | } else { | ||
1056 | usbctlx_get_rridresult(&ctlx->inbuf.rridresp, &rridresult); | ||
1057 | } | ||
1058 | |||
1059 | ctlx->usercb(hw, &rridresult, ctlx->usercb_data); | ||
1060 | } | ||
1061 | |||
1062 | DBFEXIT; | ||
1063 | } | ||
1064 | |||
1065 | static inline int | ||
1066 | hfa384x_docmd_wait(hfa384x_t *hw, hfa384x_metacmd_t *cmd) | ||
1067 | { | ||
1068 | return hfa384x_docmd(hw, DOWAIT, cmd, NULL, NULL, NULL); | ||
1069 | } | ||
1070 | |||
1071 | static inline int | ||
1072 | hfa384x_docmd_async(hfa384x_t *hw, | ||
1073 | hfa384x_metacmd_t *cmd, | ||
1074 | ctlx_cmdcb_t cmdcb, | ||
1075 | ctlx_usercb_t usercb, | ||
1076 | void *usercb_data) | ||
1077 | { | ||
1078 | return hfa384x_docmd(hw, DOASYNC, cmd, | ||
1079 | cmdcb, usercb, usercb_data); | ||
1080 | } | ||
1081 | |||
1082 | static inline int | ||
1083 | hfa384x_dorrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen) | ||
1084 | { | ||
1085 | return hfa384x_dorrid(hw, DOWAIT, | ||
1086 | rid, riddata, riddatalen, | ||
1087 | NULL, NULL, NULL); | ||
1088 | } | ||
1089 | |||
1090 | static inline int | ||
1091 | hfa384x_dorrid_async(hfa384x_t *hw, | ||
1092 | UINT16 rid, void *riddata, UINT riddatalen, | ||
1093 | ctlx_cmdcb_t cmdcb, | ||
1094 | ctlx_usercb_t usercb, | ||
1095 | void *usercb_data) | ||
1096 | { | ||
1097 | return hfa384x_dorrid(hw, DOASYNC, | ||
1098 | rid, riddata, riddatalen, | ||
1099 | cmdcb, usercb, usercb_data); | ||
1100 | } | ||
1101 | |||
1102 | static inline int | ||
1103 | hfa384x_dowrid_wait(hfa384x_t *hw, UINT16 rid, void *riddata, UINT riddatalen) | ||
1104 | { | ||
1105 | return hfa384x_dowrid(hw, DOWAIT, | ||
1106 | rid, riddata, riddatalen, | ||
1107 | NULL, NULL, NULL); | ||
1108 | } | ||
1109 | |||
1110 | static inline int | ||
1111 | hfa384x_dowrid_async(hfa384x_t *hw, | ||
1112 | UINT16 rid, void *riddata, UINT riddatalen, | ||
1113 | ctlx_cmdcb_t cmdcb, | ||
1114 | ctlx_usercb_t usercb, | ||
1115 | void *usercb_data) | ||
1116 | { | ||
1117 | return hfa384x_dowrid(hw, DOASYNC, | ||
1118 | rid, riddata, riddatalen, | ||
1119 | cmdcb, usercb, usercb_data); | ||
1120 | } | ||
1121 | |||
1122 | static inline int | ||
1123 | hfa384x_dormem_wait(hfa384x_t *hw, | ||
1124 | UINT16 page, UINT16 offset, void *data, UINT len) | ||
1125 | { | ||
1126 | return hfa384x_dormem(hw, DOWAIT, | ||
1127 | page, offset, data, len, | ||
1128 | NULL, NULL, NULL); | ||
1129 | } | ||
1130 | |||
1131 | static inline int | ||
1132 | hfa384x_dormem_async(hfa384x_t *hw, | ||
1133 | UINT16 page, UINT16 offset, void *data, UINT len, | ||
1134 | ctlx_cmdcb_t cmdcb, | ||
1135 | ctlx_usercb_t usercb, | ||
1136 | void *usercb_data) | ||
1137 | { | ||
1138 | return hfa384x_dormem(hw, DOASYNC, | ||
1139 | page, offset, data, len, | ||
1140 | cmdcb, usercb, usercb_data); | ||
1141 | } | ||
1142 | |||
1143 | static inline int | ||
1144 | hfa384x_dowmem_wait( | ||
1145 | hfa384x_t *hw, | ||
1146 | UINT16 page, | ||
1147 | UINT16 offset, | ||
1148 | void *data, | ||
1149 | UINT len) | ||
1150 | { | ||
1151 | return hfa384x_dowmem(hw, DOWAIT, | ||
1152 | page, offset, data, len, | ||
1153 | NULL, NULL, NULL); | ||
1154 | } | ||
1155 | |||
1156 | static inline int | ||
1157 | hfa384x_dowmem_async( | ||
1158 | hfa384x_t *hw, | ||
1159 | UINT16 page, | ||
1160 | UINT16 offset, | ||
1161 | void *data, | ||
1162 | UINT len, | ||
1163 | ctlx_cmdcb_t cmdcb, | ||
1164 | ctlx_usercb_t usercb, | ||
1165 | void *usercb_data) | ||
1166 | { | ||
1167 | return hfa384x_dowmem(hw, DOASYNC, | ||
1168 | page, offset, data, len, | ||
1169 | cmdcb, usercb, usercb_data); | ||
1170 | } | ||
1171 | |||
1172 | /*---------------------------------------------------------------- | ||
1173 | * hfa384x_cmd_initialize | ||
1174 | * | ||
1175 | * Issues the initialize command and sets the hw->state based | ||
1176 | * on the result. | ||
1177 | * | ||
1178 | * Arguments: | ||
1179 | * hw device structure | ||
1180 | * | ||
1181 | * Returns: | ||
1182 | * 0 success | ||
1183 | * >0 f/w reported error - f/w status code | ||
1184 | * <0 driver reported error | ||
1185 | * | ||
1186 | * Side effects: | ||
1187 | * | ||
1188 | * Call context: | ||
1189 | * process | ||
1190 | ----------------------------------------------------------------*/ | ||
1191 | int | ||
1192 | hfa384x_cmd_initialize(hfa384x_t *hw) | ||
1193 | { | ||
1194 | int result = 0; | ||
1195 | int i; | ||
1196 | hfa384x_metacmd_t cmd; | ||
1197 | |||
1198 | DBFENTER; | ||
1199 | |||
1200 | |||
1201 | cmd.cmd = HFA384x_CMDCODE_INIT; | ||
1202 | cmd.parm0 = 0; | ||
1203 | cmd.parm1 = 0; | ||
1204 | cmd.parm2 = 0; | ||
1205 | |||
1206 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1207 | |||
1208 | |||
1209 | WLAN_LOG_DEBUG(3,"cmdresp.init: " | ||
1210 | "status=0x%04x, resp0=0x%04x, " | ||
1211 | "resp1=0x%04x, resp2=0x%04x\n", | ||
1212 | cmd.result.status, | ||
1213 | cmd.result.resp0, | ||
1214 | cmd.result.resp1, | ||
1215 | cmd.result.resp2); | ||
1216 | if ( result == 0 ) { | ||
1217 | for ( i = 0; i < HFA384x_NUMPORTS_MAX; i++) { | ||
1218 | hw->port_enabled[i] = 0; | ||
1219 | } | ||
1220 | } | ||
1221 | |||
1222 | hw->link_status = HFA384x_LINK_NOTCONNECTED; | ||
1223 | |||
1224 | DBFEXIT; | ||
1225 | return result; | ||
1226 | } | ||
1227 | |||
1228 | |||
1229 | /*---------------------------------------------------------------- | ||
1230 | * hfa384x_cmd_disable | ||
1231 | * | ||
1232 | * Issues the disable command to stop communications on one of | ||
1233 | * the MACs 'ports'. | ||
1234 | * | ||
1235 | * Arguments: | ||
1236 | * hw device structure | ||
1237 | * macport MAC port number (host order) | ||
1238 | * | ||
1239 | * Returns: | ||
1240 | * 0 success | ||
1241 | * >0 f/w reported failure - f/w status code | ||
1242 | * <0 driver reported error (timeout|bad arg) | ||
1243 | * | ||
1244 | * Side effects: | ||
1245 | * | ||
1246 | * Call context: | ||
1247 | * process | ||
1248 | ----------------------------------------------------------------*/ | ||
1249 | int hfa384x_cmd_disable(hfa384x_t *hw, UINT16 macport) | ||
1250 | { | ||
1251 | int result = 0; | ||
1252 | hfa384x_metacmd_t cmd; | ||
1253 | |||
1254 | DBFENTER; | ||
1255 | |||
1256 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DISABLE) | | ||
1257 | HFA384x_CMD_MACPORT_SET(macport); | ||
1258 | cmd.parm0 = 0; | ||
1259 | cmd.parm1 = 0; | ||
1260 | cmd.parm2 = 0; | ||
1261 | |||
1262 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1263 | |||
1264 | DBFEXIT; | ||
1265 | return result; | ||
1266 | } | ||
1267 | |||
1268 | |||
1269 | /*---------------------------------------------------------------- | ||
1270 | * hfa384x_cmd_enable | ||
1271 | * | ||
1272 | * Issues the enable command to enable communications on one of | ||
1273 | * the MACs 'ports'. | ||
1274 | * | ||
1275 | * Arguments: | ||
1276 | * hw device structure | ||
1277 | * macport MAC port number | ||
1278 | * | ||
1279 | * Returns: | ||
1280 | * 0 success | ||
1281 | * >0 f/w reported failure - f/w status code | ||
1282 | * <0 driver reported error (timeout|bad arg) | ||
1283 | * | ||
1284 | * Side effects: | ||
1285 | * | ||
1286 | * Call context: | ||
1287 | * process | ||
1288 | ----------------------------------------------------------------*/ | ||
1289 | int hfa384x_cmd_enable(hfa384x_t *hw, UINT16 macport) | ||
1290 | { | ||
1291 | int result = 0; | ||
1292 | hfa384x_metacmd_t cmd; | ||
1293 | |||
1294 | DBFENTER; | ||
1295 | |||
1296 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ENABLE) | | ||
1297 | HFA384x_CMD_MACPORT_SET(macport); | ||
1298 | cmd.parm0 = 0; | ||
1299 | cmd.parm1 = 0; | ||
1300 | cmd.parm2 = 0; | ||
1301 | |||
1302 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1303 | |||
1304 | DBFEXIT; | ||
1305 | return result; | ||
1306 | } | ||
1307 | |||
1308 | |||
1309 | /*---------------------------------------------------------------- | ||
1310 | * hfa384x_cmd_notify | ||
1311 | * | ||
1312 | * Sends an info frame to the firmware to alter the behavior | ||
1313 | * of the f/w asynch processes. Can only be called when the MAC | ||
1314 | * is in the enabled state. | ||
1315 | * | ||
1316 | * Arguments: | ||
1317 | * hw device structure | ||
1318 | * reclaim [0|1] indicates whether the given FID will | ||
1319 | * be handed back (via Alloc event) for reuse. | ||
1320 | * (host order) | ||
1321 | * fid FID of buffer containing the frame that was | ||
1322 | * previously copied to MAC memory via the bap. | ||
1323 | * (host order) | ||
1324 | * | ||
1325 | * Returns: | ||
1326 | * 0 success | ||
1327 | * >0 f/w reported failure - f/w status code | ||
1328 | * <0 driver reported error (timeout|bad arg) | ||
1329 | * | ||
1330 | * Side effects: | ||
1331 | * hw->resp0 will contain the FID being used by async notify | ||
1332 | * process. If reclaim==0, resp0 will be the same as the fid | ||
1333 | * argument. If reclaim==1, resp0 will be the different. | ||
1334 | * | ||
1335 | * Call context: | ||
1336 | * process | ||
1337 | ----------------------------------------------------------------*/ | ||
1338 | int hfa384x_cmd_notify(hfa384x_t *hw, UINT16 reclaim, UINT16 fid, | ||
1339 | void *buf, UINT16 len) | ||
1340 | { | ||
1341 | #if 0 | ||
1342 | int result = 0; | ||
1343 | UINT16 cmd; | ||
1344 | DBFENTER; | ||
1345 | cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_NOTIFY) | | ||
1346 | HFA384x_CMD_RECL_SET(reclaim); | ||
1347 | result = hfa384x_docmd_wait(hw, cmd); | ||
1348 | |||
1349 | DBFEXIT; | ||
1350 | return result; | ||
1351 | #endif | ||
1352 | return 0; | ||
1353 | } | ||
1354 | |||
1355 | |||
1356 | #if 0 | ||
1357 | /*---------------------------------------------------------------- | ||
1358 | * hfa384x_cmd_inquiry | ||
1359 | * | ||
1360 | * Requests an info frame from the firmware. The info frame will | ||
1361 | * be delivered asynchronously via the Info event. | ||
1362 | * | ||
1363 | * Arguments: | ||
1364 | * hw device structure | ||
1365 | * fid FID of the info frame requested. (host order) | ||
1366 | * | ||
1367 | * Returns: | ||
1368 | * 0 success | ||
1369 | * >0 f/w reported failure - f/w status code | ||
1370 | * <0 driver reported error (timeout|bad arg) | ||
1371 | * | ||
1372 | * Side effects: | ||
1373 | * | ||
1374 | * Call context: | ||
1375 | * process | ||
1376 | ----------------------------------------------------------------*/ | ||
1377 | int hfa384x_cmd_inquiry(hfa384x_t *hw, UINT16 fid) | ||
1378 | { | ||
1379 | int result = 0; | ||
1380 | hfa384x_metacmd_t cmd; | ||
1381 | |||
1382 | DBFENTER; | ||
1383 | |||
1384 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_INQ); | ||
1385 | cmd.parm0 = 0; | ||
1386 | cmd.parm1 = 0; | ||
1387 | cmd.parm2 = 0; | ||
1388 | |||
1389 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1390 | |||
1391 | DBFEXIT; | ||
1392 | return result; | ||
1393 | } | ||
1394 | #endif | ||
1395 | |||
1396 | |||
1397 | /*---------------------------------------------------------------- | ||
1398 | * hfa384x_cmd_monitor | ||
1399 | * | ||
1400 | * Enables the 'monitor mode' of the MAC. Here's the description of | ||
1401 | * monitor mode that I've received thus far: | ||
1402 | * | ||
1403 | * "The "monitor mode" of operation is that the MAC passes all | ||
1404 | * frames for which the PLCP checks are correct. All received | ||
1405 | * MPDUs are passed to the host with MAC Port = 7, with a | ||
1406 | * receive status of good, FCS error, or undecryptable. Passing | ||
1407 | * certain MPDUs is a violation of the 802.11 standard, but useful | ||
1408 | * for a debugging tool." Normal communication is not possible | ||
1409 | * while monitor mode is enabled. | ||
1410 | * | ||
1411 | * Arguments: | ||
1412 | * hw device structure | ||
1413 | * enable a code (0x0b|0x0f) that enables/disables | ||
1414 | * monitor mode. (host order) | ||
1415 | * | ||
1416 | * Returns: | ||
1417 | * 0 success | ||
1418 | * >0 f/w reported failure - f/w status code | ||
1419 | * <0 driver reported error (timeout|bad arg) | ||
1420 | * | ||
1421 | * Side effects: | ||
1422 | * | ||
1423 | * Call context: | ||
1424 | * process | ||
1425 | ----------------------------------------------------------------*/ | ||
1426 | int hfa384x_cmd_monitor(hfa384x_t *hw, UINT16 enable) | ||
1427 | { | ||
1428 | int result = 0; | ||
1429 | hfa384x_metacmd_t cmd; | ||
1430 | |||
1431 | DBFENTER; | ||
1432 | |||
1433 | cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) | | ||
1434 | HFA384x_CMD_AINFO_SET(enable); | ||
1435 | cmd.parm0 = 0; | ||
1436 | cmd.parm1 = 0; | ||
1437 | cmd.parm2 = 0; | ||
1438 | |||
1439 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1440 | |||
1441 | DBFEXIT; | ||
1442 | return result; | ||
1443 | } | ||
1444 | |||
1445 | |||
1446 | /*---------------------------------------------------------------- | ||
1447 | * hfa384x_cmd_download | ||
1448 | * | ||
1449 | * Sets the controls for the MAC controller code/data download | ||
1450 | * process. The arguments set the mode and address associated | ||
1451 | * with a download. Note that the aux registers should be enabled | ||
1452 | * prior to setting one of the download enable modes. | ||
1453 | * | ||
1454 | * Arguments: | ||
1455 | * hw device structure | ||
1456 | * mode 0 - Disable programming and begin code exec | ||
1457 | * 1 - Enable volatile mem programming | ||
1458 | * 2 - Enable non-volatile mem programming | ||
1459 | * 3 - Program non-volatile section from NV download | ||
1460 | * buffer. | ||
1461 | * (host order) | ||
1462 | * lowaddr | ||
1463 | * highaddr For mode 1, sets the high & low order bits of | ||
1464 | * the "destination address". This address will be | ||
1465 | * the execution start address when download is | ||
1466 | * subsequently disabled. | ||
1467 | * For mode 2, sets the high & low order bits of | ||
1468 | * the destination in NV ram. | ||
1469 | * For modes 0 & 3, should be zero. (host order) | ||
1470 | * NOTE: these are CMD format. | ||
1471 | * codelen Length of the data to write in mode 2, | ||
1472 | * zero otherwise. (host order) | ||
1473 | * | ||
1474 | * Returns: | ||
1475 | * 0 success | ||
1476 | * >0 f/w reported failure - f/w status code | ||
1477 | * <0 driver reported error (timeout|bad arg) | ||
1478 | * | ||
1479 | * Side effects: | ||
1480 | * | ||
1481 | * Call context: | ||
1482 | * process | ||
1483 | ----------------------------------------------------------------*/ | ||
1484 | int hfa384x_cmd_download(hfa384x_t *hw, UINT16 mode, UINT16 lowaddr, | ||
1485 | UINT16 highaddr, UINT16 codelen) | ||
1486 | { | ||
1487 | int result = 0; | ||
1488 | hfa384x_metacmd_t cmd; | ||
1489 | |||
1490 | DBFENTER; | ||
1491 | WLAN_LOG_DEBUG(5, | ||
1492 | "mode=%d, lowaddr=0x%04x, highaddr=0x%04x, codelen=%d\n", | ||
1493 | mode, lowaddr, highaddr, codelen); | ||
1494 | |||
1495 | cmd.cmd = (HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DOWNLD) | | ||
1496 | HFA384x_CMD_PROGMODE_SET(mode)); | ||
1497 | |||
1498 | cmd.parm0 = lowaddr; | ||
1499 | cmd.parm1 = highaddr; | ||
1500 | cmd.parm2 = codelen; | ||
1501 | |||
1502 | result = hfa384x_docmd_wait(hw, &cmd); | ||
1503 | |||
1504 | DBFEXIT; | ||
1505 | return result; | ||
1506 | } | ||
1507 | |||
1508 | |||
1509 | /*---------------------------------------------------------------- | ||
1510 | * hfa384x_copy_from_aux | ||
1511 | * | ||
1512 | * Copies a collection of bytes from the controller memory. The | ||
1513 | * Auxiliary port MUST be enabled prior to calling this function. | ||
1514 | * We _might_ be in a download state. | ||
1515 | * | ||
1516 | * Arguments: | ||
1517 | * hw device structure | ||
1518 | * cardaddr address in hfa384x data space to read | ||
1519 | * auxctl address space select | ||
1520 | * buf ptr to destination host buffer | ||
1521 | * len length of data to transfer (in bytes) | ||
1522 | * | ||
1523 | * Returns: | ||
1524 | * nothing | ||
1525 | * | ||
1526 | * Side effects: | ||
1527 | * buf contains the data copied | ||
1528 | * | ||
1529 | * Call context: | ||
1530 | * process | ||
1531 | * interrupt | ||
1532 | ----------------------------------------------------------------*/ | ||
1533 | void | ||
1534 | hfa384x_copy_from_aux( | ||
1535 | hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len) | ||
1536 | { | ||
1537 | DBFENTER; | ||
1538 | WLAN_LOG_ERROR("not used in USB.\n"); | ||
1539 | DBFEXIT; | ||
1540 | } | ||
1541 | |||
1542 | |||
1543 | /*---------------------------------------------------------------- | ||
1544 | * hfa384x_copy_to_aux | ||
1545 | * | ||
1546 | * Copies a collection of bytes to the controller memory. The | ||
1547 | * Auxiliary port MUST be enabled prior to calling this function. | ||
1548 | * We _might_ be in a download state. | ||
1549 | * | ||
1550 | * Arguments: | ||
1551 | * hw device structure | ||
1552 | * cardaddr address in hfa384x data space to read | ||
1553 | * auxctl address space select | ||
1554 | * buf ptr to destination host buffer | ||
1555 | * len length of data to transfer (in bytes) | ||
1556 | * | ||
1557 | * Returns: | ||
1558 | * nothing | ||
1559 | * | ||
1560 | * Side effects: | ||
1561 | * Controller memory now contains a copy of buf | ||
1562 | * | ||
1563 | * Call context: | ||
1564 | * process | ||
1565 | * interrupt | ||
1566 | ----------------------------------------------------------------*/ | ||
1567 | void | ||
1568 | hfa384x_copy_to_aux( | ||
1569 | hfa384x_t *hw, UINT32 cardaddr, UINT32 auxctl, void *buf, UINT len) | ||
1570 | { | ||
1571 | DBFENTER; | ||
1572 | WLAN_LOG_ERROR("not used in USB.\n"); | ||
1573 | DBFEXIT; | ||
1574 | } | ||
1575 | |||
1576 | |||
1577 | /*---------------------------------------------------------------- | ||
1578 | * hfa384x_corereset | ||
1579 | * | ||
1580 | * Perform a reset of the hfa38xx MAC core. We assume that the hw | ||
1581 | * structure is in its "created" state. That is, it is initialized | ||
1582 | * with proper values. Note that if a reset is done after the | ||
1583 | * device has been active for awhile, the caller might have to clean | ||
1584 | * up some leftover cruft in the hw structure. | ||
1585 | * | ||
1586 | * Arguments: | ||
1587 | * hw device structure | ||
1588 | * holdtime how long (in ms) to hold the reset | ||
1589 | * settletime how long (in ms) to wait after releasing | ||
1590 | * the reset | ||
1591 | * | ||
1592 | * Returns: | ||
1593 | * nothing | ||
1594 | * | ||
1595 | * Side effects: | ||
1596 | * | ||
1597 | * Call context: | ||
1598 | * process | ||
1599 | ----------------------------------------------------------------*/ | ||
1600 | int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis) | ||
1601 | { | ||
1602 | #if 0 | ||
1603 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
1604 | struct usb_device *parent = hw->usb->parent; | ||
1605 | int i; | ||
1606 | int port = -1; | ||
1607 | #endif | ||
1608 | #endif | ||
1609 | int result = 0; | ||
1610 | |||
1611 | |||
1612 | #define P2_USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) | ||
1613 | #define P2_USB_FEAT_RESET 4 | ||
1614 | #define P2_USB_FEAT_C_RESET 20 | ||
1615 | |||
1616 | DBFENTER; | ||
1617 | |||
1618 | #if 0 | ||
1619 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
1620 | /* Find the hub port */ | ||
1621 | for ( i = 0; i < parent->maxchild; i++) { | ||
1622 | if (parent->children[i] == hw->usb) { | ||
1623 | port = i; | ||
1624 | break; | ||
1625 | } | ||
1626 | } | ||
1627 | if (port < 0) return -ENOENT; | ||
1628 | |||
1629 | /* Set and clear the reset */ | ||
1630 | usb_control_msg(parent, usb_sndctrlpipe(parent, 0), | ||
1631 | USB_REQ_SET_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_RESET, | ||
1632 | port+1, NULL, 0, 1*HZ); | ||
1633 | wait_ms(holdtime); | ||
1634 | usb_control_msg(parent, usb_sndctrlpipe(parent, 0), | ||
1635 | USB_REQ_CLEAR_FEATURE, P2_USB_RT_PORT, P2_USB_FEAT_C_RESET, | ||
1636 | port+1, NULL, 0, 1*HZ); | ||
1637 | wait_ms(settletime); | ||
1638 | |||
1639 | /* Set the device address */ | ||
1640 | result=usb_set_address(hw->usb); | ||
1641 | if (result < 0) { | ||
1642 | WLAN_LOG_ERROR("reset_usbdev: Dev not accepting address, " | ||
1643 | "result=%d\n", result); | ||
1644 | clear_bit(hw->usb->devnum, &hw->usb->bus->devmap.devicemap); | ||
1645 | hw->usb->devnum = -1; | ||
1646 | goto done; | ||
1647 | } | ||
1648 | /* Let the address settle */ | ||
1649 | wait_ms(20); | ||
1650 | |||
1651 | /* Assume we're reusing the original descriptor data */ | ||
1652 | |||
1653 | /* Set the configuration. */ | ||
1654 | WLAN_LOG_DEBUG(3, "Setting Configuration %d\n", | ||
1655 | hw->usb->config[0].bConfigurationValue); | ||
1656 | result=usb_set_configuration(hw->usb, hw->usb->config[0].bConfigurationValue); | ||
1657 | if ( result ) { | ||
1658 | WLAN_LOG_ERROR("usb_set_configuration() failed, result=%d.\n", | ||
1659 | result); | ||
1660 | goto done; | ||
1661 | } | ||
1662 | /* Let the configuration settle */ | ||
1663 | wait_ms(20); | ||
1664 | |||
1665 | done: | ||
1666 | #else | ||
1667 | result=usb_reset_device(hw->usb); | ||
1668 | if(result<0) { | ||
1669 | WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result); | ||
1670 | } | ||
1671 | #endif | ||
1672 | #endif | ||
1673 | |||
1674 | result=usb_reset_device(hw->usb); | ||
1675 | if(result<0) { | ||
1676 | WLAN_LOG_ERROR("usb_reset_device() failed, result=%d.\n",result); | ||
1677 | } | ||
1678 | |||
1679 | DBFEXIT; | ||
1680 | return result; | ||
1681 | } | ||
1682 | |||
1683 | |||
1684 | /*---------------------------------------------------------------- | ||
1685 | * hfa384x_usbctlx_complete_sync | ||
1686 | * | ||
1687 | * Waits for a synchronous CTLX object to complete, | ||
1688 | * and then handles the response. | ||
1689 | * | ||
1690 | * Arguments: | ||
1691 | * hw device structure | ||
1692 | * ctlx CTLX ptr | ||
1693 | * completor functor object to decide what to | ||
1694 | * do with the CTLX's result. | ||
1695 | * | ||
1696 | * Returns: | ||
1697 | * 0 Success | ||
1698 | * -ERESTARTSYS Interrupted by a signal | ||
1699 | * -EIO CTLX failed | ||
1700 | * -ENODEV Adapter was unplugged | ||
1701 | * ??? Result from completor | ||
1702 | * | ||
1703 | * Side effects: | ||
1704 | * | ||
1705 | * Call context: | ||
1706 | * process | ||
1707 | ----------------------------------------------------------------*/ | ||
1708 | static int hfa384x_usbctlx_complete_sync(hfa384x_t *hw, | ||
1709 | hfa384x_usbctlx_t *ctlx, | ||
1710 | usbctlx_completor_t *completor) | ||
1711 | { | ||
1712 | unsigned long flags; | ||
1713 | int result; | ||
1714 | |||
1715 | DBFENTER; | ||
1716 | |||
1717 | result = wait_for_completion_interruptible(&ctlx->done); | ||
1718 | |||
1719 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
1720 | |||
1721 | /* | ||
1722 | * We can only handle the CTLX if the USB disconnect | ||
1723 | * function has not run yet ... | ||
1724 | */ | ||
1725 | cleanup: | ||
1726 | if ( hw->wlandev->hwremoved ) | ||
1727 | { | ||
1728 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
1729 | result = -ENODEV; | ||
1730 | } | ||
1731 | else if ( result != 0 ) | ||
1732 | { | ||
1733 | int runqueue = 0; | ||
1734 | |||
1735 | /* | ||
1736 | * We were probably interrupted, so delete | ||
1737 | * this CTLX asynchronously, kill the timers | ||
1738 | * and the URB, and then start the next | ||
1739 | * pending CTLX. | ||
1740 | * | ||
1741 | * NOTE: We can only delete the timers and | ||
1742 | * the URB if this CTLX is active. | ||
1743 | */ | ||
1744 | if (ctlx == get_active_ctlx(hw)) | ||
1745 | { | ||
1746 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
1747 | |||
1748 | del_singleshot_timer_sync(&hw->reqtimer); | ||
1749 | del_singleshot_timer_sync(&hw->resptimer); | ||
1750 | hw->req_timer_done = 1; | ||
1751 | hw->resp_timer_done = 1; | ||
1752 | usb_kill_urb(&hw->ctlx_urb); | ||
1753 | |||
1754 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
1755 | |||
1756 | runqueue = 1; | ||
1757 | |||
1758 | /* | ||
1759 | * This scenario is so unlikely that I'm | ||
1760 | * happy with a grubby "goto" solution ... | ||
1761 | */ | ||
1762 | if ( hw->wlandev->hwremoved ) | ||
1763 | goto cleanup; | ||
1764 | } | ||
1765 | |||
1766 | /* | ||
1767 | * The completion task will send this CTLX | ||
1768 | * to the reaper the next time it runs. We | ||
1769 | * are no longer in a hurry. | ||
1770 | */ | ||
1771 | ctlx->reapable = 1; | ||
1772 | ctlx->state = CTLX_REQ_FAILED; | ||
1773 | list_move_tail(&ctlx->list, &hw->ctlxq.completing); | ||
1774 | |||
1775 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
1776 | |||
1777 | if (runqueue) | ||
1778 | hfa384x_usbctlxq_run(hw); | ||
1779 | } else { | ||
1780 | if (ctlx->state == CTLX_COMPLETE) { | ||
1781 | result = completor->complete(completor); | ||
1782 | } else { | ||
1783 | WLAN_LOG_WARNING("CTLX[%d] error: state(%s)\n", | ||
1784 | hfa384x2host_16(ctlx->outbuf.type), | ||
1785 | ctlxstr(ctlx->state)); | ||
1786 | result = -EIO; | ||
1787 | } | ||
1788 | |||
1789 | list_del(&ctlx->list); | ||
1790 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
1791 | kfree(ctlx); | ||
1792 | } | ||
1793 | |||
1794 | DBFEXIT; | ||
1795 | return result; | ||
1796 | } | ||
1797 | |||
1798 | /*---------------------------------------------------------------- | ||
1799 | * hfa384x_docmd | ||
1800 | * | ||
1801 | * Constructs a command CTLX and submits it. | ||
1802 | * | ||
1803 | * NOTE: Any changes to the 'post-submit' code in this function | ||
1804 | * need to be carried over to hfa384x_cbcmd() since the handling | ||
1805 | * is virtually identical. | ||
1806 | * | ||
1807 | * Arguments: | ||
1808 | * hw device structure | ||
1809 | * mode DOWAIT or DOASYNC | ||
1810 | * cmd cmd structure. Includes all arguments and result | ||
1811 | * data points. All in host order. in host order | ||
1812 | * cmdcb command-specific callback | ||
1813 | * usercb user callback for async calls, NULL for DOWAIT calls | ||
1814 | * usercb_data user supplied data pointer for async calls, NULL | ||
1815 | * for DOASYNC calls | ||
1816 | * | ||
1817 | * Returns: | ||
1818 | * 0 success | ||
1819 | * -EIO CTLX failure | ||
1820 | * -ERESTARTSYS Awakened on signal | ||
1821 | * >0 command indicated error, Status and Resp0-2 are | ||
1822 | * in hw structure. | ||
1823 | * | ||
1824 | * Side effects: | ||
1825 | * | ||
1826 | * | ||
1827 | * Call context: | ||
1828 | * process | ||
1829 | ----------------------------------------------------------------*/ | ||
1830 | static int | ||
1831 | hfa384x_docmd( | ||
1832 | hfa384x_t *hw, | ||
1833 | CMD_MODE mode, | ||
1834 | hfa384x_metacmd_t *cmd, | ||
1835 | ctlx_cmdcb_t cmdcb, | ||
1836 | ctlx_usercb_t usercb, | ||
1837 | void *usercb_data) | ||
1838 | { | ||
1839 | int result; | ||
1840 | hfa384x_usbctlx_t *ctlx; | ||
1841 | |||
1842 | DBFENTER; | ||
1843 | ctlx = usbctlx_alloc(); | ||
1844 | if ( ctlx == NULL ) { | ||
1845 | result = -ENOMEM; | ||
1846 | goto done; | ||
1847 | } | ||
1848 | |||
1849 | /* Initialize the command */ | ||
1850 | ctlx->outbuf.cmdreq.type = host2hfa384x_16(HFA384x_USB_CMDREQ); | ||
1851 | ctlx->outbuf.cmdreq.cmd = host2hfa384x_16(cmd->cmd); | ||
1852 | ctlx->outbuf.cmdreq.parm0 = host2hfa384x_16(cmd->parm0); | ||
1853 | ctlx->outbuf.cmdreq.parm1 = host2hfa384x_16(cmd->parm1); | ||
1854 | ctlx->outbuf.cmdreq.parm2 = host2hfa384x_16(cmd->parm2); | ||
1855 | |||
1856 | ctlx->outbufsize = sizeof(ctlx->outbuf.cmdreq); | ||
1857 | |||
1858 | WLAN_LOG_DEBUG(4, "cmdreq: cmd=0x%04x " | ||
1859 | "parm0=0x%04x parm1=0x%04x parm2=0x%04x\n", | ||
1860 | cmd->cmd, | ||
1861 | cmd->parm0, | ||
1862 | cmd->parm1, | ||
1863 | cmd->parm2); | ||
1864 | |||
1865 | ctlx->reapable = mode; | ||
1866 | ctlx->cmdcb = cmdcb; | ||
1867 | ctlx->usercb = usercb; | ||
1868 | ctlx->usercb_data = usercb_data; | ||
1869 | |||
1870 | result = hfa384x_usbctlx_submit(hw, ctlx); | ||
1871 | if (result != 0) { | ||
1872 | kfree(ctlx); | ||
1873 | } else if (mode == DOWAIT) { | ||
1874 | usbctlx_cmd_completor_t completor; | ||
1875 | |||
1876 | result = hfa384x_usbctlx_complete_sync( | ||
1877 | hw, ctlx, init_cmd_completor(&completor, | ||
1878 | &ctlx->inbuf.cmdresp, | ||
1879 | &cmd->result) ); | ||
1880 | } | ||
1881 | |||
1882 | done: | ||
1883 | DBFEXIT; | ||
1884 | return result; | ||
1885 | } | ||
1886 | |||
1887 | |||
1888 | /*---------------------------------------------------------------- | ||
1889 | * hfa384x_dorrid | ||
1890 | * | ||
1891 | * Constructs a read rid CTLX and issues it. | ||
1892 | * | ||
1893 | * NOTE: Any changes to the 'post-submit' code in this function | ||
1894 | * need to be carried over to hfa384x_cbrrid() since the handling | ||
1895 | * is virtually identical. | ||
1896 | * | ||
1897 | * Arguments: | ||
1898 | * hw device structure | ||
1899 | * mode DOWAIT or DOASYNC | ||
1900 | * rid Read RID number (host order) | ||
1901 | * riddata Caller supplied buffer that MAC formatted RID.data | ||
1902 | * record will be written to for DOWAIT calls. Should | ||
1903 | * be NULL for DOASYNC calls. | ||
1904 | * riddatalen Buffer length for DOWAIT calls. Zero for DOASYNC calls. | ||
1905 | * cmdcb command callback for async calls, NULL for DOWAIT calls | ||
1906 | * usercb user callback for async calls, NULL for DOWAIT calls | ||
1907 | * usercb_data user supplied data pointer for async calls, NULL | ||
1908 | * for DOWAIT calls | ||
1909 | * | ||
1910 | * Returns: | ||
1911 | * 0 success | ||
1912 | * -EIO CTLX failure | ||
1913 | * -ERESTARTSYS Awakened on signal | ||
1914 | * -ENODATA riddatalen != macdatalen | ||
1915 | * >0 command indicated error, Status and Resp0-2 are | ||
1916 | * in hw structure. | ||
1917 | * | ||
1918 | * Side effects: | ||
1919 | * | ||
1920 | * Call context: | ||
1921 | * interrupt (DOASYNC) | ||
1922 | * process (DOWAIT or DOASYNC) | ||
1923 | ----------------------------------------------------------------*/ | ||
1924 | static int | ||
1925 | hfa384x_dorrid( | ||
1926 | hfa384x_t *hw, | ||
1927 | CMD_MODE mode, | ||
1928 | UINT16 rid, | ||
1929 | void *riddata, | ||
1930 | UINT riddatalen, | ||
1931 | ctlx_cmdcb_t cmdcb, | ||
1932 | ctlx_usercb_t usercb, | ||
1933 | void *usercb_data) | ||
1934 | { | ||
1935 | int result; | ||
1936 | hfa384x_usbctlx_t *ctlx; | ||
1937 | |||
1938 | DBFENTER; | ||
1939 | ctlx = usbctlx_alloc(); | ||
1940 | if ( ctlx == NULL ) { | ||
1941 | result = -ENOMEM; | ||
1942 | goto done; | ||
1943 | } | ||
1944 | |||
1945 | /* Initialize the command */ | ||
1946 | ctlx->outbuf.rridreq.type = host2hfa384x_16(HFA384x_USB_RRIDREQ); | ||
1947 | ctlx->outbuf.rridreq.frmlen = | ||
1948 | host2hfa384x_16(sizeof(ctlx->outbuf.rridreq.rid)); | ||
1949 | ctlx->outbuf.rridreq.rid = host2hfa384x_16(rid); | ||
1950 | |||
1951 | ctlx->outbufsize = sizeof(ctlx->outbuf.rridreq); | ||
1952 | |||
1953 | ctlx->reapable = mode; | ||
1954 | ctlx->cmdcb = cmdcb; | ||
1955 | ctlx->usercb = usercb; | ||
1956 | ctlx->usercb_data = usercb_data; | ||
1957 | |||
1958 | /* Submit the CTLX */ | ||
1959 | result = hfa384x_usbctlx_submit(hw, ctlx); | ||
1960 | if (result != 0) { | ||
1961 | kfree(ctlx); | ||
1962 | } else if (mode == DOWAIT) { | ||
1963 | usbctlx_rrid_completor_t completor; | ||
1964 | |||
1965 | result = hfa384x_usbctlx_complete_sync( | ||
1966 | hw, ctlx, init_rrid_completor(&completor, | ||
1967 | &ctlx->inbuf.rridresp, | ||
1968 | riddata, | ||
1969 | riddatalen) ); | ||
1970 | } | ||
1971 | |||
1972 | done: | ||
1973 | DBFEXIT; | ||
1974 | return result; | ||
1975 | } | ||
1976 | |||
1977 | |||
1978 | /*---------------------------------------------------------------- | ||
1979 | * hfa384x_dowrid | ||
1980 | * | ||
1981 | * Constructs a write rid CTLX and issues it. | ||
1982 | * | ||
1983 | * NOTE: Any changes to the 'post-submit' code in this function | ||
1984 | * need to be carried over to hfa384x_cbwrid() since the handling | ||
1985 | * is virtually identical. | ||
1986 | * | ||
1987 | * Arguments: | ||
1988 | * hw device structure | ||
1989 | * CMD_MODE DOWAIT or DOASYNC | ||
1990 | * rid RID code | ||
1991 | * riddata Data portion of RID formatted for MAC | ||
1992 | * riddatalen Length of the data portion in bytes | ||
1993 | * cmdcb command callback for async calls, NULL for DOWAIT calls | ||
1994 | * usercb user callback for async calls, NULL for DOWAIT calls | ||
1995 | * usercb_data user supplied data pointer for async calls | ||
1996 | * | ||
1997 | * Returns: | ||
1998 | * 0 success | ||
1999 | * -ETIMEDOUT timed out waiting for register ready or | ||
2000 | * command completion | ||
2001 | * >0 command indicated error, Status and Resp0-2 are | ||
2002 | * in hw structure. | ||
2003 | * | ||
2004 | * Side effects: | ||
2005 | * | ||
2006 | * Call context: | ||
2007 | * interrupt (DOASYNC) | ||
2008 | * process (DOWAIT or DOASYNC) | ||
2009 | ----------------------------------------------------------------*/ | ||
2010 | static int | ||
2011 | hfa384x_dowrid( | ||
2012 | hfa384x_t *hw, | ||
2013 | CMD_MODE mode, | ||
2014 | UINT16 rid, | ||
2015 | void *riddata, | ||
2016 | UINT riddatalen, | ||
2017 | ctlx_cmdcb_t cmdcb, | ||
2018 | ctlx_usercb_t usercb, | ||
2019 | void *usercb_data) | ||
2020 | { | ||
2021 | int result; | ||
2022 | hfa384x_usbctlx_t *ctlx; | ||
2023 | |||
2024 | DBFENTER; | ||
2025 | ctlx = usbctlx_alloc(); | ||
2026 | if ( ctlx == NULL ) { | ||
2027 | result = -ENOMEM; | ||
2028 | goto done; | ||
2029 | } | ||
2030 | |||
2031 | /* Initialize the command */ | ||
2032 | ctlx->outbuf.wridreq.type = host2hfa384x_16(HFA384x_USB_WRIDREQ); | ||
2033 | ctlx->outbuf.wridreq.frmlen = host2hfa384x_16( | ||
2034 | (sizeof(ctlx->outbuf.wridreq.rid) + | ||
2035 | riddatalen + 1) / 2); | ||
2036 | ctlx->outbuf.wridreq.rid = host2hfa384x_16(rid); | ||
2037 | memcpy(ctlx->outbuf.wridreq.data, riddata, riddatalen); | ||
2038 | |||
2039 | ctlx->outbufsize = sizeof(ctlx->outbuf.wridreq.type) + | ||
2040 | sizeof(ctlx->outbuf.wridreq.frmlen) + | ||
2041 | sizeof(ctlx->outbuf.wridreq.rid) + | ||
2042 | riddatalen; | ||
2043 | |||
2044 | ctlx->reapable = mode; | ||
2045 | ctlx->cmdcb = cmdcb; | ||
2046 | ctlx->usercb = usercb; | ||
2047 | ctlx->usercb_data = usercb_data; | ||
2048 | |||
2049 | /* Submit the CTLX */ | ||
2050 | result = hfa384x_usbctlx_submit(hw, ctlx); | ||
2051 | if (result != 0) { | ||
2052 | kfree(ctlx); | ||
2053 | } else if (mode == DOWAIT) { | ||
2054 | usbctlx_wrid_completor_t completor; | ||
2055 | hfa384x_cmdresult_t wridresult; | ||
2056 | |||
2057 | result = hfa384x_usbctlx_complete_sync( | ||
2058 | hw, | ||
2059 | ctlx, | ||
2060 | init_wrid_completor(&completor, | ||
2061 | &ctlx->inbuf.wridresp, | ||
2062 | &wridresult) ); | ||
2063 | } | ||
2064 | |||
2065 | done: | ||
2066 | DBFEXIT; | ||
2067 | return result; | ||
2068 | } | ||
2069 | |||
2070 | /*---------------------------------------------------------------- | ||
2071 | * hfa384x_dormem | ||
2072 | * | ||
2073 | * Constructs a readmem CTLX and issues it. | ||
2074 | * | ||
2075 | * NOTE: Any changes to the 'post-submit' code in this function | ||
2076 | * need to be carried over to hfa384x_cbrmem() since the handling | ||
2077 | * is virtually identical. | ||
2078 | * | ||
2079 | * Arguments: | ||
2080 | * hw device structure | ||
2081 | * mode DOWAIT or DOASYNC | ||
2082 | * page MAC address space page (CMD format) | ||
2083 | * offset MAC address space offset | ||
2084 | * data Ptr to data buffer to receive read | ||
2085 | * len Length of the data to read (max == 2048) | ||
2086 | * cmdcb command callback for async calls, NULL for DOWAIT calls | ||
2087 | * usercb user callback for async calls, NULL for DOWAIT calls | ||
2088 | * usercb_data user supplied data pointer for async calls | ||
2089 | * | ||
2090 | * Returns: | ||
2091 | * 0 success | ||
2092 | * -ETIMEDOUT timed out waiting for register ready or | ||
2093 | * command completion | ||
2094 | * >0 command indicated error, Status and Resp0-2 are | ||
2095 | * in hw structure. | ||
2096 | * | ||
2097 | * Side effects: | ||
2098 | * | ||
2099 | * Call context: | ||
2100 | * interrupt (DOASYNC) | ||
2101 | * process (DOWAIT or DOASYNC) | ||
2102 | ----------------------------------------------------------------*/ | ||
2103 | static int | ||
2104 | hfa384x_dormem( | ||
2105 | hfa384x_t *hw, | ||
2106 | CMD_MODE mode, | ||
2107 | UINT16 page, | ||
2108 | UINT16 offset, | ||
2109 | void *data, | ||
2110 | UINT len, | ||
2111 | ctlx_cmdcb_t cmdcb, | ||
2112 | ctlx_usercb_t usercb, | ||
2113 | void *usercb_data) | ||
2114 | { | ||
2115 | int result; | ||
2116 | hfa384x_usbctlx_t *ctlx; | ||
2117 | |||
2118 | DBFENTER; | ||
2119 | ctlx = usbctlx_alloc(); | ||
2120 | if ( ctlx == NULL ) { | ||
2121 | result = -ENOMEM; | ||
2122 | goto done; | ||
2123 | } | ||
2124 | |||
2125 | /* Initialize the command */ | ||
2126 | ctlx->outbuf.rmemreq.type = host2hfa384x_16(HFA384x_USB_RMEMREQ); | ||
2127 | ctlx->outbuf.rmemreq.frmlen = host2hfa384x_16( | ||
2128 | sizeof(ctlx->outbuf.rmemreq.offset) + | ||
2129 | sizeof(ctlx->outbuf.rmemreq.page) + | ||
2130 | len); | ||
2131 | ctlx->outbuf.rmemreq.offset = host2hfa384x_16(offset); | ||
2132 | ctlx->outbuf.rmemreq.page = host2hfa384x_16(page); | ||
2133 | |||
2134 | ctlx->outbufsize = sizeof(ctlx->outbuf.rmemreq); | ||
2135 | |||
2136 | WLAN_LOG_DEBUG(4, | ||
2137 | "type=0x%04x frmlen=%d offset=0x%04x page=0x%04x\n", | ||
2138 | ctlx->outbuf.rmemreq.type, | ||
2139 | ctlx->outbuf.rmemreq.frmlen, | ||
2140 | ctlx->outbuf.rmemreq.offset, | ||
2141 | ctlx->outbuf.rmemreq.page); | ||
2142 | |||
2143 | WLAN_LOG_DEBUG(4,"pktsize=%zd\n", | ||
2144 | ROUNDUP64(sizeof(ctlx->outbuf.rmemreq))); | ||
2145 | |||
2146 | ctlx->reapable = mode; | ||
2147 | ctlx->cmdcb = cmdcb; | ||
2148 | ctlx->usercb = usercb; | ||
2149 | ctlx->usercb_data = usercb_data; | ||
2150 | |||
2151 | result = hfa384x_usbctlx_submit(hw, ctlx); | ||
2152 | if (result != 0) { | ||
2153 | kfree(ctlx); | ||
2154 | } else if ( mode == DOWAIT ) { | ||
2155 | usbctlx_rmem_completor_t completor; | ||
2156 | |||
2157 | result = hfa384x_usbctlx_complete_sync( | ||
2158 | hw, ctlx, init_rmem_completor(&completor, | ||
2159 | &ctlx->inbuf.rmemresp, | ||
2160 | data, | ||
2161 | len) ); | ||
2162 | } | ||
2163 | |||
2164 | done: | ||
2165 | DBFEXIT; | ||
2166 | return result; | ||
2167 | } | ||
2168 | |||
2169 | |||
2170 | |||
2171 | /*---------------------------------------------------------------- | ||
2172 | * hfa384x_dowmem | ||
2173 | * | ||
2174 | * Constructs a writemem CTLX and issues it. | ||
2175 | * | ||
2176 | * NOTE: Any changes to the 'post-submit' code in this function | ||
2177 | * need to be carried over to hfa384x_cbwmem() since the handling | ||
2178 | * is virtually identical. | ||
2179 | * | ||
2180 | * Arguments: | ||
2181 | * hw device structure | ||
2182 | * mode DOWAIT or DOASYNC | ||
2183 | * page MAC address space page (CMD format) | ||
2184 | * offset MAC address space offset | ||
2185 | * data Ptr to data buffer containing write data | ||
2186 | * len Length of the data to read (max == 2048) | ||
2187 | * cmdcb command callback for async calls, NULL for DOWAIT calls | ||
2188 | * usercb user callback for async calls, NULL for DOWAIT calls | ||
2189 | * usercb_data user supplied data pointer for async calls. | ||
2190 | * | ||
2191 | * Returns: | ||
2192 | * 0 success | ||
2193 | * -ETIMEDOUT timed out waiting for register ready or | ||
2194 | * command completion | ||
2195 | * >0 command indicated error, Status and Resp0-2 are | ||
2196 | * in hw structure. | ||
2197 | * | ||
2198 | * Side effects: | ||
2199 | * | ||
2200 | * Call context: | ||
2201 | * interrupt (DOWAIT) | ||
2202 | * process (DOWAIT or DOASYNC) | ||
2203 | ----------------------------------------------------------------*/ | ||
2204 | static int | ||
2205 | hfa384x_dowmem( | ||
2206 | hfa384x_t *hw, | ||
2207 | CMD_MODE mode, | ||
2208 | UINT16 page, | ||
2209 | UINT16 offset, | ||
2210 | void *data, | ||
2211 | UINT len, | ||
2212 | ctlx_cmdcb_t cmdcb, | ||
2213 | ctlx_usercb_t usercb, | ||
2214 | void *usercb_data) | ||
2215 | { | ||
2216 | int result; | ||
2217 | hfa384x_usbctlx_t *ctlx; | ||
2218 | |||
2219 | DBFENTER; | ||
2220 | WLAN_LOG_DEBUG(5, "page=0x%04x offset=0x%04x len=%d\n", | ||
2221 | page,offset,len); | ||
2222 | |||
2223 | ctlx = usbctlx_alloc(); | ||
2224 | if ( ctlx == NULL ) { | ||
2225 | result = -ENOMEM; | ||
2226 | goto done; | ||
2227 | } | ||
2228 | |||
2229 | /* Initialize the command */ | ||
2230 | ctlx->outbuf.wmemreq.type = host2hfa384x_16(HFA384x_USB_WMEMREQ); | ||
2231 | ctlx->outbuf.wmemreq.frmlen = host2hfa384x_16( | ||
2232 | sizeof(ctlx->outbuf.wmemreq.offset) + | ||
2233 | sizeof(ctlx->outbuf.wmemreq.page) + | ||
2234 | len); | ||
2235 | ctlx->outbuf.wmemreq.offset = host2hfa384x_16(offset); | ||
2236 | ctlx->outbuf.wmemreq.page = host2hfa384x_16(page); | ||
2237 | memcpy(ctlx->outbuf.wmemreq.data, data, len); | ||
2238 | |||
2239 | ctlx->outbufsize = sizeof(ctlx->outbuf.wmemreq.type) + | ||
2240 | sizeof(ctlx->outbuf.wmemreq.frmlen) + | ||
2241 | sizeof(ctlx->outbuf.wmemreq.offset) + | ||
2242 | sizeof(ctlx->outbuf.wmemreq.page) + | ||
2243 | len; | ||
2244 | |||
2245 | ctlx->reapable = mode; | ||
2246 | ctlx->cmdcb = cmdcb; | ||
2247 | ctlx->usercb = usercb; | ||
2248 | ctlx->usercb_data = usercb_data; | ||
2249 | |||
2250 | result = hfa384x_usbctlx_submit(hw, ctlx); | ||
2251 | if (result != 0) { | ||
2252 | kfree(ctlx); | ||
2253 | } else if ( mode == DOWAIT ) { | ||
2254 | usbctlx_wmem_completor_t completor; | ||
2255 | hfa384x_cmdresult_t wmemresult; | ||
2256 | |||
2257 | result = hfa384x_usbctlx_complete_sync( | ||
2258 | hw, | ||
2259 | ctlx, | ||
2260 | init_wmem_completor(&completor, | ||
2261 | &ctlx->inbuf.wmemresp, | ||
2262 | &wmemresult) ); | ||
2263 | } | ||
2264 | |||
2265 | done: | ||
2266 | DBFEXIT; | ||
2267 | return result; | ||
2268 | } | ||
2269 | |||
2270 | |||
2271 | /*---------------------------------------------------------------- | ||
2272 | * hfa384x_drvr_commtallies | ||
2273 | * | ||
2274 | * Send a commtallies inquiry to the MAC. Note that this is an async | ||
2275 | * call that will result in an info frame arriving sometime later. | ||
2276 | * | ||
2277 | * Arguments: | ||
2278 | * hw device structure | ||
2279 | * | ||
2280 | * Returns: | ||
2281 | * zero success. | ||
2282 | * | ||
2283 | * Side effects: | ||
2284 | * | ||
2285 | * Call context: | ||
2286 | * process | ||
2287 | ----------------------------------------------------------------*/ | ||
2288 | int hfa384x_drvr_commtallies( hfa384x_t *hw ) | ||
2289 | { | ||
2290 | hfa384x_metacmd_t cmd; | ||
2291 | |||
2292 | DBFENTER; | ||
2293 | |||
2294 | cmd.cmd = HFA384x_CMDCODE_INQ; | ||
2295 | cmd.parm0 = HFA384x_IT_COMMTALLIES; | ||
2296 | cmd.parm1 = 0; | ||
2297 | cmd.parm2 = 0; | ||
2298 | |||
2299 | hfa384x_docmd_async(hw, &cmd, NULL, NULL, NULL); | ||
2300 | |||
2301 | DBFEXIT; | ||
2302 | return 0; | ||
2303 | } | ||
2304 | |||
2305 | |||
2306 | /*---------------------------------------------------------------- | ||
2307 | * hfa384x_drvr_disable | ||
2308 | * | ||
2309 | * Issues the disable command to stop communications on one of | ||
2310 | * the MACs 'ports'. Only macport 0 is valid for stations. | ||
2311 | * APs may also disable macports 1-6. Only ports that have been | ||
2312 | * previously enabled may be disabled. | ||
2313 | * | ||
2314 | * Arguments: | ||
2315 | * hw device structure | ||
2316 | * macport MAC port number (host order) | ||
2317 | * | ||
2318 | * Returns: | ||
2319 | * 0 success | ||
2320 | * >0 f/w reported failure - f/w status code | ||
2321 | * <0 driver reported error (timeout|bad arg) | ||
2322 | * | ||
2323 | * Side effects: | ||
2324 | * | ||
2325 | * Call context: | ||
2326 | * process | ||
2327 | ----------------------------------------------------------------*/ | ||
2328 | int hfa384x_drvr_disable(hfa384x_t *hw, UINT16 macport) | ||
2329 | { | ||
2330 | int result = 0; | ||
2331 | |||
2332 | DBFENTER; | ||
2333 | if ((!hw->isap && macport != 0) || | ||
2334 | (hw->isap && !(macport <= HFA384x_PORTID_MAX)) || | ||
2335 | !(hw->port_enabled[macport]) ){ | ||
2336 | result = -EINVAL; | ||
2337 | } else { | ||
2338 | result = hfa384x_cmd_disable(hw, macport); | ||
2339 | if ( result == 0 ) { | ||
2340 | hw->port_enabled[macport] = 0; | ||
2341 | } | ||
2342 | } | ||
2343 | DBFEXIT; | ||
2344 | return result; | ||
2345 | } | ||
2346 | |||
2347 | |||
2348 | /*---------------------------------------------------------------- | ||
2349 | * hfa384x_drvr_enable | ||
2350 | * | ||
2351 | * Issues the enable command to enable communications on one of | ||
2352 | * the MACs 'ports'. Only macport 0 is valid for stations. | ||
2353 | * APs may also enable macports 1-6. Only ports that are currently | ||
2354 | * disabled may be enabled. | ||
2355 | * | ||
2356 | * Arguments: | ||
2357 | * hw device structure | ||
2358 | * macport MAC port number | ||
2359 | * | ||
2360 | * Returns: | ||
2361 | * 0 success | ||
2362 | * >0 f/w reported failure - f/w status code | ||
2363 | * <0 driver reported error (timeout|bad arg) | ||
2364 | * | ||
2365 | * Side effects: | ||
2366 | * | ||
2367 | * Call context: | ||
2368 | * process | ||
2369 | ----------------------------------------------------------------*/ | ||
2370 | int hfa384x_drvr_enable(hfa384x_t *hw, UINT16 macport) | ||
2371 | { | ||
2372 | int result = 0; | ||
2373 | |||
2374 | DBFENTER; | ||
2375 | if ((!hw->isap && macport != 0) || | ||
2376 | (hw->isap && !(macport <= HFA384x_PORTID_MAX)) || | ||
2377 | (hw->port_enabled[macport]) ){ | ||
2378 | result = -EINVAL; | ||
2379 | } else { | ||
2380 | result = hfa384x_cmd_enable(hw, macport); | ||
2381 | if ( result == 0 ) { | ||
2382 | hw->port_enabled[macport] = 1; | ||
2383 | } | ||
2384 | } | ||
2385 | DBFEXIT; | ||
2386 | return result; | ||
2387 | } | ||
2388 | |||
2389 | |||
2390 | /*---------------------------------------------------------------- | ||
2391 | * hfa384x_drvr_flashdl_enable | ||
2392 | * | ||
2393 | * Begins the flash download state. Checks to see that we're not | ||
2394 | * already in a download state and that a port isn't enabled. | ||
2395 | * Sets the download state and retrieves the flash download | ||
2396 | * buffer location, buffer size, and timeout length. | ||
2397 | * | ||
2398 | * Arguments: | ||
2399 | * hw device structure | ||
2400 | * | ||
2401 | * Returns: | ||
2402 | * 0 success | ||
2403 | * >0 f/w reported error - f/w status code | ||
2404 | * <0 driver reported error | ||
2405 | * | ||
2406 | * Side effects: | ||
2407 | * | ||
2408 | * Call context: | ||
2409 | * process | ||
2410 | ----------------------------------------------------------------*/ | ||
2411 | int hfa384x_drvr_flashdl_enable(hfa384x_t *hw) | ||
2412 | { | ||
2413 | int result = 0; | ||
2414 | int i; | ||
2415 | |||
2416 | DBFENTER; | ||
2417 | /* Check that a port isn't active */ | ||
2418 | for ( i = 0; i < HFA384x_PORTID_MAX; i++) { | ||
2419 | if ( hw->port_enabled[i] ) { | ||
2420 | WLAN_LOG_DEBUG(1,"called when port enabled.\n"); | ||
2421 | return -EINVAL; | ||
2422 | } | ||
2423 | } | ||
2424 | |||
2425 | /* Check that we're not already in a download state */ | ||
2426 | if ( hw->dlstate != HFA384x_DLSTATE_DISABLED ) { | ||
2427 | return -EINVAL; | ||
2428 | } | ||
2429 | |||
2430 | /* Retrieve the buffer loc&size and timeout */ | ||
2431 | if ( (result = hfa384x_drvr_getconfig(hw, HFA384x_RID_DOWNLOADBUFFER, | ||
2432 | &(hw->bufinfo), sizeof(hw->bufinfo))) ) { | ||
2433 | return result; | ||
2434 | } | ||
2435 | hw->bufinfo.page = hfa384x2host_16(hw->bufinfo.page); | ||
2436 | hw->bufinfo.offset = hfa384x2host_16(hw->bufinfo.offset); | ||
2437 | hw->bufinfo.len = hfa384x2host_16(hw->bufinfo.len); | ||
2438 | if ( (result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_MAXLOADTIME, | ||
2439 | &(hw->dltimeout))) ) { | ||
2440 | return result; | ||
2441 | } | ||
2442 | hw->dltimeout = hfa384x2host_16(hw->dltimeout); | ||
2443 | |||
2444 | WLAN_LOG_DEBUG(1,"flashdl_enable\n"); | ||
2445 | |||
2446 | hw->dlstate = HFA384x_DLSTATE_FLASHENABLED; | ||
2447 | DBFEXIT; | ||
2448 | return result; | ||
2449 | } | ||
2450 | |||
2451 | |||
2452 | /*---------------------------------------------------------------- | ||
2453 | * hfa384x_drvr_flashdl_disable | ||
2454 | * | ||
2455 | * Ends the flash download state. Note that this will cause the MAC | ||
2456 | * firmware to restart. | ||
2457 | * | ||
2458 | * Arguments: | ||
2459 | * hw device structure | ||
2460 | * | ||
2461 | * Returns: | ||
2462 | * 0 success | ||
2463 | * >0 f/w reported error - f/w status code | ||
2464 | * <0 driver reported error | ||
2465 | * | ||
2466 | * Side effects: | ||
2467 | * | ||
2468 | * Call context: | ||
2469 | * process | ||
2470 | ----------------------------------------------------------------*/ | ||
2471 | int hfa384x_drvr_flashdl_disable(hfa384x_t *hw) | ||
2472 | { | ||
2473 | DBFENTER; | ||
2474 | /* Check that we're already in the download state */ | ||
2475 | if ( hw->dlstate != HFA384x_DLSTATE_FLASHENABLED ) { | ||
2476 | return -EINVAL; | ||
2477 | } | ||
2478 | |||
2479 | WLAN_LOG_DEBUG(1,"flashdl_enable\n"); | ||
2480 | |||
2481 | /* There isn't much we can do at this point, so I don't */ | ||
2482 | /* bother w/ the return value */ | ||
2483 | hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0); | ||
2484 | hw->dlstate = HFA384x_DLSTATE_DISABLED; | ||
2485 | |||
2486 | DBFEXIT; | ||
2487 | return 0; | ||
2488 | } | ||
2489 | |||
2490 | |||
2491 | /*---------------------------------------------------------------- | ||
2492 | * hfa384x_drvr_flashdl_write | ||
2493 | * | ||
2494 | * Performs a FLASH download of a chunk of data. First checks to see | ||
2495 | * that we're in the FLASH download state, then sets the download | ||
2496 | * mode, uses the aux functions to 1) copy the data to the flash | ||
2497 | * buffer, 2) sets the download 'write flash' mode, 3) readback and | ||
2498 | * compare. Lather rinse, repeat as many times an necessary to get | ||
2499 | * all the given data into flash. | ||
2500 | * When all data has been written using this function (possibly | ||
2501 | * repeatedly), call drvr_flashdl_disable() to end the download state | ||
2502 | * and restart the MAC. | ||
2503 | * | ||
2504 | * Arguments: | ||
2505 | * hw device structure | ||
2506 | * daddr Card address to write to. (host order) | ||
2507 | * buf Ptr to data to write. | ||
2508 | * len Length of data (host order). | ||
2509 | * | ||
2510 | * Returns: | ||
2511 | * 0 success | ||
2512 | * >0 f/w reported error - f/w status code | ||
2513 | * <0 driver reported error | ||
2514 | * | ||
2515 | * Side effects: | ||
2516 | * | ||
2517 | * Call context: | ||
2518 | * process | ||
2519 | ----------------------------------------------------------------*/ | ||
2520 | int | ||
2521 | hfa384x_drvr_flashdl_write( | ||
2522 | hfa384x_t *hw, | ||
2523 | UINT32 daddr, | ||
2524 | void *buf, | ||
2525 | UINT32 len) | ||
2526 | { | ||
2527 | int result = 0; | ||
2528 | UINT32 dlbufaddr; | ||
2529 | int nburns; | ||
2530 | UINT32 burnlen; | ||
2531 | UINT32 burndaddr; | ||
2532 | UINT16 burnlo; | ||
2533 | UINT16 burnhi; | ||
2534 | int nwrites; | ||
2535 | UINT8 *writebuf; | ||
2536 | UINT16 writepage; | ||
2537 | UINT16 writeoffset; | ||
2538 | UINT32 writelen; | ||
2539 | int i; | ||
2540 | int j; | ||
2541 | |||
2542 | DBFENTER; | ||
2543 | WLAN_LOG_DEBUG(5,"daddr=0x%08x len=%d\n", daddr, len); | ||
2544 | |||
2545 | /* Check that we're in the flash download state */ | ||
2546 | if ( hw->dlstate != HFA384x_DLSTATE_FLASHENABLED ) { | ||
2547 | return -EINVAL; | ||
2548 | } | ||
2549 | |||
2550 | WLAN_LOG_INFO("Download %d bytes to flash @0x%06x\n", len, daddr); | ||
2551 | |||
2552 | /* Convert to flat address for arithmetic */ | ||
2553 | /* NOTE: dlbuffer RID stores the address in AUX format */ | ||
2554 | dlbufaddr = HFA384x_ADDR_AUX_MKFLAT( | ||
2555 | hw->bufinfo.page, hw->bufinfo.offset); | ||
2556 | WLAN_LOG_DEBUG(5, | ||
2557 | "dlbuf.page=0x%04x dlbuf.offset=0x%04x dlbufaddr=0x%08x\n", | ||
2558 | hw->bufinfo.page, hw->bufinfo.offset, dlbufaddr); | ||
2559 | |||
2560 | #if 0 | ||
2561 | WLAN_LOG_WARNING("dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, hw->bufinfo.len, hw->dltimeout); | ||
2562 | #endif | ||
2563 | /* Calculations to determine how many fills of the dlbuffer to do | ||
2564 | * and how many USB wmemreq's to do for each fill. At this point | ||
2565 | * in time, the dlbuffer size and the wmemreq size are the same. | ||
2566 | * Therefore, nwrites should always be 1. The extra complexity | ||
2567 | * here is a hedge against future changes. | ||
2568 | */ | ||
2569 | |||
2570 | /* Figure out how many times to do the flash programming */ | ||
2571 | nburns = len / hw->bufinfo.len; | ||
2572 | nburns += (len % hw->bufinfo.len) ? 1 : 0; | ||
2573 | |||
2574 | /* For each flash program cycle, how many USB wmemreq's are needed? */ | ||
2575 | nwrites = hw->bufinfo.len / HFA384x_USB_RWMEM_MAXLEN; | ||
2576 | nwrites += (hw->bufinfo.len % HFA384x_USB_RWMEM_MAXLEN) ? 1 : 0; | ||
2577 | |||
2578 | /* For each burn */ | ||
2579 | for ( i = 0; i < nburns; i++) { | ||
2580 | /* Get the dest address and len */ | ||
2581 | burnlen = (len - (hw->bufinfo.len * i)) > hw->bufinfo.len ? | ||
2582 | hw->bufinfo.len : | ||
2583 | (len - (hw->bufinfo.len * i)); | ||
2584 | burndaddr = daddr + (hw->bufinfo.len * i); | ||
2585 | burnlo = HFA384x_ADDR_CMD_MKOFF(burndaddr); | ||
2586 | burnhi = HFA384x_ADDR_CMD_MKPAGE(burndaddr); | ||
2587 | |||
2588 | WLAN_LOG_INFO("Writing %d bytes to flash @0x%06x\n", | ||
2589 | burnlen, burndaddr); | ||
2590 | |||
2591 | /* Set the download mode */ | ||
2592 | result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_NV, | ||
2593 | burnlo, burnhi, burnlen); | ||
2594 | if ( result ) { | ||
2595 | WLAN_LOG_ERROR("download(NV,lo=%x,hi=%x,len=%x) " | ||
2596 | "cmd failed, result=%d. Aborting d/l\n", | ||
2597 | burnlo, burnhi, burnlen, result); | ||
2598 | goto exit_proc; | ||
2599 | } | ||
2600 | |||
2601 | /* copy the data to the flash download buffer */ | ||
2602 | for ( j=0; j < nwrites; j++) { | ||
2603 | writebuf = buf + | ||
2604 | (i*hw->bufinfo.len) + | ||
2605 | (j*HFA384x_USB_RWMEM_MAXLEN); | ||
2606 | |||
2607 | writepage = HFA384x_ADDR_CMD_MKPAGE( | ||
2608 | dlbufaddr + | ||
2609 | (j*HFA384x_USB_RWMEM_MAXLEN)); | ||
2610 | writeoffset = HFA384x_ADDR_CMD_MKOFF( | ||
2611 | dlbufaddr + | ||
2612 | (j*HFA384x_USB_RWMEM_MAXLEN)); | ||
2613 | |||
2614 | writelen = burnlen-(j*HFA384x_USB_RWMEM_MAXLEN); | ||
2615 | writelen = writelen > HFA384x_USB_RWMEM_MAXLEN ? | ||
2616 | HFA384x_USB_RWMEM_MAXLEN : | ||
2617 | writelen; | ||
2618 | |||
2619 | result = hfa384x_dowmem_wait( hw, | ||
2620 | writepage, | ||
2621 | writeoffset, | ||
2622 | writebuf, | ||
2623 | writelen ); | ||
2624 | #if 0 | ||
2625 | |||
2626 | Comment out for debugging, assume the write was successful. | ||
2627 | if (result) { | ||
2628 | WLAN_LOG_ERROR( | ||
2629 | "Write to dl buffer failed, " | ||
2630 | "result=0x%04x. Aborting.\n", | ||
2631 | result); | ||
2632 | goto exit_proc; | ||
2633 | } | ||
2634 | #endif | ||
2635 | |||
2636 | } | ||
2637 | |||
2638 | /* set the download 'write flash' mode */ | ||
2639 | result = hfa384x_cmd_download(hw, | ||
2640 | HFA384x_PROGMODE_NVWRITE, | ||
2641 | 0,0,0); | ||
2642 | if ( result ) { | ||
2643 | WLAN_LOG_ERROR( | ||
2644 | "download(NVWRITE,lo=%x,hi=%x,len=%x) " | ||
2645 | "cmd failed, result=%d. Aborting d/l\n", | ||
2646 | burnlo, burnhi, burnlen, result); | ||
2647 | goto exit_proc; | ||
2648 | } | ||
2649 | |||
2650 | /* TODO: We really should do a readback and compare. */ | ||
2651 | } | ||
2652 | |||
2653 | exit_proc: | ||
2654 | |||
2655 | /* Leave the firmware in the 'post-prog' mode. flashdl_disable will */ | ||
2656 | /* actually disable programming mode. Remember, that will cause the */ | ||
2657 | /* the firmware to effectively reset itself. */ | ||
2658 | |||
2659 | DBFEXIT; | ||
2660 | return result; | ||
2661 | } | ||
2662 | |||
2663 | |||
2664 | /*---------------------------------------------------------------- | ||
2665 | * hfa384x_drvr_getconfig | ||
2666 | * | ||
2667 | * Performs the sequence necessary to read a config/info item. | ||
2668 | * | ||
2669 | * Arguments: | ||
2670 | * hw device structure | ||
2671 | * rid config/info record id (host order) | ||
2672 | * buf host side record buffer. Upon return it will | ||
2673 | * contain the body portion of the record (minus the | ||
2674 | * RID and len). | ||
2675 | * len buffer length (in bytes, should match record length) | ||
2676 | * | ||
2677 | * Returns: | ||
2678 | * 0 success | ||
2679 | * >0 f/w reported error - f/w status code | ||
2680 | * <0 driver reported error | ||
2681 | * -ENODATA length mismatch between argument and retrieved | ||
2682 | * record. | ||
2683 | * | ||
2684 | * Side effects: | ||
2685 | * | ||
2686 | * Call context: | ||
2687 | * process | ||
2688 | ----------------------------------------------------------------*/ | ||
2689 | int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) | ||
2690 | { | ||
2691 | int result; | ||
2692 | DBFENTER; | ||
2693 | |||
2694 | result = hfa384x_dorrid_wait(hw, rid, buf, len); | ||
2695 | |||
2696 | DBFEXIT; | ||
2697 | return result; | ||
2698 | } | ||
2699 | |||
2700 | /*---------------------------------------------------------------- | ||
2701 | * hfa384x_drvr_getconfig_async | ||
2702 | * | ||
2703 | * Performs the sequence necessary to perform an async read of | ||
2704 | * of a config/info item. | ||
2705 | * | ||
2706 | * Arguments: | ||
2707 | * hw device structure | ||
2708 | * rid config/info record id (host order) | ||
2709 | * buf host side record buffer. Upon return it will | ||
2710 | * contain the body portion of the record (minus the | ||
2711 | * RID and len). | ||
2712 | * len buffer length (in bytes, should match record length) | ||
2713 | * cbfn caller supplied callback, called when the command | ||
2714 | * is done (successful or not). | ||
2715 | * cbfndata pointer to some caller supplied data that will be | ||
2716 | * passed in as an argument to the cbfn. | ||
2717 | * | ||
2718 | * Returns: | ||
2719 | * nothing the cbfn gets a status argument identifying if | ||
2720 | * any errors occur. | ||
2721 | * Side effects: | ||
2722 | * Queues an hfa384x_usbcmd_t for subsequent execution. | ||
2723 | * | ||
2724 | * Call context: | ||
2725 | * Any | ||
2726 | ----------------------------------------------------------------*/ | ||
2727 | int | ||
2728 | hfa384x_drvr_getconfig_async( | ||
2729 | hfa384x_t *hw, | ||
2730 | UINT16 rid, | ||
2731 | ctlx_usercb_t usercb, | ||
2732 | void *usercb_data) | ||
2733 | { | ||
2734 | return hfa384x_dorrid_async(hw, rid, NULL, 0, | ||
2735 | hfa384x_cb_rrid, usercb, usercb_data); | ||
2736 | } | ||
2737 | |||
2738 | /*---------------------------------------------------------------- | ||
2739 | * hfa384x_drvr_setconfig_async | ||
2740 | * | ||
2741 | * Performs the sequence necessary to write a config/info item. | ||
2742 | * | ||
2743 | * Arguments: | ||
2744 | * hw device structure | ||
2745 | * rid config/info record id (in host order) | ||
2746 | * buf host side record buffer | ||
2747 | * len buffer length (in bytes) | ||
2748 | * usercb completion callback | ||
2749 | * usercb_data completion callback argument | ||
2750 | * | ||
2751 | * Returns: | ||
2752 | * 0 success | ||
2753 | * >0 f/w reported error - f/w status code | ||
2754 | * <0 driver reported error | ||
2755 | * | ||
2756 | * Side effects: | ||
2757 | * | ||
2758 | * Call context: | ||
2759 | * process | ||
2760 | ----------------------------------------------------------------*/ | ||
2761 | int | ||
2762 | hfa384x_drvr_setconfig_async( | ||
2763 | hfa384x_t *hw, | ||
2764 | UINT16 rid, | ||
2765 | void *buf, | ||
2766 | UINT16 len, | ||
2767 | ctlx_usercb_t usercb, | ||
2768 | void *usercb_data) | ||
2769 | { | ||
2770 | return hfa384x_dowrid_async(hw, rid, buf, len, | ||
2771 | hfa384x_cb_status, usercb, usercb_data); | ||
2772 | } | ||
2773 | |||
2774 | /*---------------------------------------------------------------- | ||
2775 | * hfa384x_drvr_handover | ||
2776 | * | ||
2777 | * Sends a handover notification to the MAC. | ||
2778 | * | ||
2779 | * Arguments: | ||
2780 | * hw device structure | ||
2781 | * addr address of station that's left | ||
2782 | * | ||
2783 | * Returns: | ||
2784 | * zero success. | ||
2785 | * -ERESTARTSYS received signal while waiting for semaphore. | ||
2786 | * -EIO failed to write to bap, or failed in cmd. | ||
2787 | * | ||
2788 | * Side effects: | ||
2789 | * | ||
2790 | * Call context: | ||
2791 | * process | ||
2792 | ----------------------------------------------------------------*/ | ||
2793 | int hfa384x_drvr_handover( hfa384x_t *hw, UINT8 *addr) | ||
2794 | { | ||
2795 | DBFENTER; | ||
2796 | WLAN_LOG_ERROR("Not currently supported in USB!\n"); | ||
2797 | DBFEXIT; | ||
2798 | return -EIO; | ||
2799 | } | ||
2800 | |||
2801 | /*---------------------------------------------------------------- | ||
2802 | * hfa384x_drvr_low_level | ||
2803 | * | ||
2804 | * Write test commands to the card. Some test commands don't make | ||
2805 | * sense without prior set-up. For example, continous TX isn't very | ||
2806 | * useful until you set the channel. That functionality should be | ||
2807 | * | ||
2808 | * Side effects: | ||
2809 | * | ||
2810 | * Call context: | ||
2811 | * process thread | ||
2812 | * -----------------------------------------------------------------*/ | ||
2813 | int hfa384x_drvr_low_level(hfa384x_t *hw, hfa384x_metacmd_t *cmd) | ||
2814 | { | ||
2815 | int result; | ||
2816 | DBFENTER; | ||
2817 | |||
2818 | /* Do i need a host2hfa... conversion ? */ | ||
2819 | |||
2820 | result = hfa384x_docmd_wait(hw, cmd); | ||
2821 | |||
2822 | DBFEXIT; | ||
2823 | return result; | ||
2824 | } | ||
2825 | |||
2826 | /*---------------------------------------------------------------- | ||
2827 | * hfa384x_drvr_mmi_read | ||
2828 | * | ||
2829 | * Read mmi registers. mmi is intersil-speak for the baseband | ||
2830 | * processor registers. | ||
2831 | * | ||
2832 | * Arguments: | ||
2833 | * hw device structure | ||
2834 | * register The test register to be accessed (must be even #). | ||
2835 | * | ||
2836 | * Returns: | ||
2837 | * 0 success | ||
2838 | * >0 f/w reported error - f/w status code | ||
2839 | * <0 driver reported error | ||
2840 | * | ||
2841 | * Side effects: | ||
2842 | * | ||
2843 | * Call context: | ||
2844 | * process | ||
2845 | ----------------------------------------------------------------*/ | ||
2846 | int hfa384x_drvr_mmi_read(hfa384x_t *hw, UINT32 addr, UINT32 *resp) | ||
2847 | { | ||
2848 | #if 0 | ||
2849 | int result = 0; | ||
2850 | UINT16 cmd_code = (UINT16) 0x30; | ||
2851 | UINT16 param = (UINT16) addr; | ||
2852 | DBFENTER; | ||
2853 | |||
2854 | /* Do i need a host2hfa... conversion ? */ | ||
2855 | result = hfa384x_docmd_wait(hw, cmd_code); | ||
2856 | |||
2857 | DBFEXIT; | ||
2858 | return result; | ||
2859 | #endif | ||
2860 | return 0; | ||
2861 | } | ||
2862 | |||
2863 | /*---------------------------------------------------------------- | ||
2864 | * hfa384x_drvr_mmi_write | ||
2865 | * | ||
2866 | * Read mmi registers. mmi is intersil-speak for the baseband | ||
2867 | * processor registers. | ||
2868 | * | ||
2869 | * Arguments: | ||
2870 | * hw device structure | ||
2871 | * addr The test register to be accessed (must be even #). | ||
2872 | * data The data value to write to the register. | ||
2873 | * | ||
2874 | * Returns: | ||
2875 | * 0 success | ||
2876 | * >0 f/w reported error - f/w status code | ||
2877 | * <0 driver reported error | ||
2878 | * | ||
2879 | * Side effects: | ||
2880 | * | ||
2881 | * Call context: | ||
2882 | * process | ||
2883 | ----------------------------------------------------------------*/ | ||
2884 | |||
2885 | int | ||
2886 | hfa384x_drvr_mmi_write(hfa384x_t *hw, UINT32 addr, UINT32 data) | ||
2887 | { | ||
2888 | #if 0 | ||
2889 | int result = 0; | ||
2890 | UINT16 cmd_code = (UINT16) 0x31; | ||
2891 | UINT16 param0 = (UINT16) addr; | ||
2892 | UINT16 param1 = (UINT16) data; | ||
2893 | DBFENTER; | ||
2894 | |||
2895 | WLAN_LOG_DEBUG(1,"mmi write : addr = 0x%08lx\n", addr); | ||
2896 | WLAN_LOG_DEBUG(1,"mmi write : data = 0x%08lx\n", data); | ||
2897 | |||
2898 | /* Do i need a host2hfa... conversion ? */ | ||
2899 | result = hfa384x_docmd_wait(hw, cmd_code); | ||
2900 | |||
2901 | DBFEXIT; | ||
2902 | return result; | ||
2903 | #endif | ||
2904 | return 0; | ||
2905 | } | ||
2906 | |||
2907 | |||
2908 | /*---------------------------------------------------------------- | ||
2909 | * hfa384x_drvr_ramdl_disable | ||
2910 | * | ||
2911 | * Ends the ram download state. | ||
2912 | * | ||
2913 | * Arguments: | ||
2914 | * hw device structure | ||
2915 | * | ||
2916 | * Returns: | ||
2917 | * 0 success | ||
2918 | * >0 f/w reported error - f/w status code | ||
2919 | * <0 driver reported error | ||
2920 | * | ||
2921 | * Side effects: | ||
2922 | * | ||
2923 | * Call context: | ||
2924 | * process | ||
2925 | ----------------------------------------------------------------*/ | ||
2926 | int | ||
2927 | hfa384x_drvr_ramdl_disable(hfa384x_t *hw) | ||
2928 | { | ||
2929 | DBFENTER; | ||
2930 | /* Check that we're already in the download state */ | ||
2931 | if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) { | ||
2932 | return -EINVAL; | ||
2933 | } | ||
2934 | |||
2935 | WLAN_LOG_DEBUG(3,"ramdl_disable()\n"); | ||
2936 | |||
2937 | /* There isn't much we can do at this point, so I don't */ | ||
2938 | /* bother w/ the return value */ | ||
2939 | hfa384x_cmd_download(hw, HFA384x_PROGMODE_DISABLE, 0, 0 , 0); | ||
2940 | hw->dlstate = HFA384x_DLSTATE_DISABLED; | ||
2941 | |||
2942 | DBFEXIT; | ||
2943 | return 0; | ||
2944 | } | ||
2945 | |||
2946 | |||
2947 | /*---------------------------------------------------------------- | ||
2948 | * hfa384x_drvr_ramdl_enable | ||
2949 | * | ||
2950 | * Begins the ram download state. Checks to see that we're not | ||
2951 | * already in a download state and that a port isn't enabled. | ||
2952 | * Sets the download state and calls cmd_download with the | ||
2953 | * ENABLE_VOLATILE subcommand and the exeaddr argument. | ||
2954 | * | ||
2955 | * Arguments: | ||
2956 | * hw device structure | ||
2957 | * exeaddr the card execution address that will be | ||
2958 | * jumped to when ramdl_disable() is called | ||
2959 | * (host order). | ||
2960 | * | ||
2961 | * Returns: | ||
2962 | * 0 success | ||
2963 | * >0 f/w reported error - f/w status code | ||
2964 | * <0 driver reported error | ||
2965 | * | ||
2966 | * Side effects: | ||
2967 | * | ||
2968 | * Call context: | ||
2969 | * process | ||
2970 | ----------------------------------------------------------------*/ | ||
2971 | int | ||
2972 | hfa384x_drvr_ramdl_enable(hfa384x_t *hw, UINT32 exeaddr) | ||
2973 | { | ||
2974 | int result = 0; | ||
2975 | UINT16 lowaddr; | ||
2976 | UINT16 hiaddr; | ||
2977 | int i; | ||
2978 | DBFENTER; | ||
2979 | /* Check that a port isn't active */ | ||
2980 | for ( i = 0; i < HFA384x_PORTID_MAX; i++) { | ||
2981 | if ( hw->port_enabled[i] ) { | ||
2982 | WLAN_LOG_ERROR( | ||
2983 | "Can't download with a macport enabled.\n"); | ||
2984 | return -EINVAL; | ||
2985 | } | ||
2986 | } | ||
2987 | |||
2988 | /* Check that we're not already in a download state */ | ||
2989 | if ( hw->dlstate != HFA384x_DLSTATE_DISABLED ) { | ||
2990 | WLAN_LOG_ERROR( | ||
2991 | "Download state not disabled.\n"); | ||
2992 | return -EINVAL; | ||
2993 | } | ||
2994 | |||
2995 | WLAN_LOG_DEBUG(3,"ramdl_enable, exeaddr=0x%08x\n", exeaddr); | ||
2996 | |||
2997 | /* Call the download(1,addr) function */ | ||
2998 | lowaddr = HFA384x_ADDR_CMD_MKOFF(exeaddr); | ||
2999 | hiaddr = HFA384x_ADDR_CMD_MKPAGE(exeaddr); | ||
3000 | |||
3001 | result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_RAM, | ||
3002 | lowaddr, hiaddr, 0); | ||
3003 | |||
3004 | if ( result == 0) { | ||
3005 | /* Set the download state */ | ||
3006 | hw->dlstate = HFA384x_DLSTATE_RAMENABLED; | ||
3007 | } else { | ||
3008 | WLAN_LOG_DEBUG(1, | ||
3009 | "cmd_download(0x%04x, 0x%04x) failed, result=%d.\n", | ||
3010 | lowaddr, | ||
3011 | hiaddr, | ||
3012 | result); | ||
3013 | } | ||
3014 | |||
3015 | DBFEXIT; | ||
3016 | return result; | ||
3017 | } | ||
3018 | |||
3019 | |||
3020 | /*---------------------------------------------------------------- | ||
3021 | * hfa384x_drvr_ramdl_write | ||
3022 | * | ||
3023 | * Performs a RAM download of a chunk of data. First checks to see | ||
3024 | * that we're in the RAM download state, then uses the [read|write]mem USB | ||
3025 | * commands to 1) copy the data, 2) readback and compare. The download | ||
3026 | * state is unaffected. When all data has been written using | ||
3027 | * this function, call drvr_ramdl_disable() to end the download state | ||
3028 | * and restart the MAC. | ||
3029 | * | ||
3030 | * Arguments: | ||
3031 | * hw device structure | ||
3032 | * daddr Card address to write to. (host order) | ||
3033 | * buf Ptr to data to write. | ||
3034 | * len Length of data (host order). | ||
3035 | * | ||
3036 | * Returns: | ||
3037 | * 0 success | ||
3038 | * >0 f/w reported error - f/w status code | ||
3039 | * <0 driver reported error | ||
3040 | * | ||
3041 | * Side effects: | ||
3042 | * | ||
3043 | * Call context: | ||
3044 | * process | ||
3045 | ----------------------------------------------------------------*/ | ||
3046 | int | ||
3047 | hfa384x_drvr_ramdl_write(hfa384x_t *hw, UINT32 daddr, void* buf, UINT32 len) | ||
3048 | { | ||
3049 | int result = 0; | ||
3050 | int nwrites; | ||
3051 | UINT8 *data = buf; | ||
3052 | int i; | ||
3053 | UINT32 curraddr; | ||
3054 | UINT16 currpage; | ||
3055 | UINT16 curroffset; | ||
3056 | UINT16 currlen; | ||
3057 | DBFENTER; | ||
3058 | /* Check that we're in the ram download state */ | ||
3059 | if ( hw->dlstate != HFA384x_DLSTATE_RAMENABLED ) { | ||
3060 | return -EINVAL; | ||
3061 | } | ||
3062 | |||
3063 | WLAN_LOG_INFO("Writing %d bytes to ram @0x%06x\n", len, daddr); | ||
3064 | |||
3065 | /* How many dowmem calls? */ | ||
3066 | nwrites = len / HFA384x_USB_RWMEM_MAXLEN; | ||
3067 | nwrites += len % HFA384x_USB_RWMEM_MAXLEN ? 1 : 0; | ||
3068 | |||
3069 | /* Do blocking wmem's */ | ||
3070 | for(i=0; i < nwrites; i++) { | ||
3071 | /* make address args */ | ||
3072 | curraddr = daddr + (i * HFA384x_USB_RWMEM_MAXLEN); | ||
3073 | currpage = HFA384x_ADDR_CMD_MKPAGE(curraddr); | ||
3074 | curroffset = HFA384x_ADDR_CMD_MKOFF(curraddr); | ||
3075 | currlen = len - (i * HFA384x_USB_RWMEM_MAXLEN); | ||
3076 | if ( currlen > HFA384x_USB_RWMEM_MAXLEN) { | ||
3077 | currlen = HFA384x_USB_RWMEM_MAXLEN; | ||
3078 | } | ||
3079 | |||
3080 | /* Do blocking ctlx */ | ||
3081 | result = hfa384x_dowmem_wait( hw, | ||
3082 | currpage, | ||
3083 | curroffset, | ||
3084 | data + (i*HFA384x_USB_RWMEM_MAXLEN), | ||
3085 | currlen ); | ||
3086 | |||
3087 | if (result) break; | ||
3088 | |||
3089 | /* TODO: We really should have a readback. */ | ||
3090 | } | ||
3091 | |||
3092 | DBFEXIT; | ||
3093 | return result; | ||
3094 | } | ||
3095 | |||
3096 | |||
3097 | /*---------------------------------------------------------------- | ||
3098 | * hfa384x_drvr_readpda | ||
3099 | * | ||
3100 | * Performs the sequence to read the PDA space. Note there is no | ||
3101 | * drvr_writepda() function. Writing a PDA is | ||
3102 | * generally implemented by a calling component via calls to | ||
3103 | * cmd_download and writing to the flash download buffer via the | ||
3104 | * aux regs. | ||
3105 | * | ||
3106 | * Arguments: | ||
3107 | * hw device structure | ||
3108 | * buf buffer to store PDA in | ||
3109 | * len buffer length | ||
3110 | * | ||
3111 | * Returns: | ||
3112 | * 0 success | ||
3113 | * >0 f/w reported error - f/w status code | ||
3114 | * <0 driver reported error | ||
3115 | * -ETIMEOUT timout waiting for the cmd regs to become | ||
3116 | * available, or waiting for the control reg | ||
3117 | * to indicate the Aux port is enabled. | ||
3118 | * -ENODATA the buffer does NOT contain a valid PDA. | ||
3119 | * Either the card PDA is bad, or the auxdata | ||
3120 | * reads are giving us garbage. | ||
3121 | |||
3122 | * | ||
3123 | * Side effects: | ||
3124 | * | ||
3125 | * Call context: | ||
3126 | * process or non-card interrupt. | ||
3127 | ----------------------------------------------------------------*/ | ||
3128 | int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len) | ||
3129 | { | ||
3130 | int result = 0; | ||
3131 | UINT16 *pda = buf; | ||
3132 | int pdaok = 0; | ||
3133 | int morepdrs = 1; | ||
3134 | int currpdr = 0; /* word offset of the current pdr */ | ||
3135 | size_t i; | ||
3136 | UINT16 pdrlen; /* pdr length in bytes, host order */ | ||
3137 | UINT16 pdrcode; /* pdr code, host order */ | ||
3138 | UINT16 currpage; | ||
3139 | UINT16 curroffset; | ||
3140 | struct pdaloc { | ||
3141 | UINT32 cardaddr; | ||
3142 | UINT16 auxctl; | ||
3143 | } pdaloc[] = | ||
3144 | { | ||
3145 | { HFA3842_PDA_BASE, 0}, | ||
3146 | { HFA3841_PDA_BASE, 0}, | ||
3147 | { HFA3841_PDA_BOGUS_BASE, 0} | ||
3148 | }; | ||
3149 | |||
3150 | DBFENTER; | ||
3151 | |||
3152 | /* Read the pda from each known address. */ | ||
3153 | for ( i = 0; i < ARRAY_SIZE(pdaloc); i++) { | ||
3154 | /* Make address */ | ||
3155 | currpage = HFA384x_ADDR_CMD_MKPAGE(pdaloc[i].cardaddr); | ||
3156 | curroffset = HFA384x_ADDR_CMD_MKOFF(pdaloc[i].cardaddr); | ||
3157 | |||
3158 | result = hfa384x_dormem_wait(hw, | ||
3159 | currpage, | ||
3160 | curroffset, | ||
3161 | buf, | ||
3162 | len); /* units of bytes */ | ||
3163 | |||
3164 | if (result) { | ||
3165 | WLAN_LOG_WARNING( | ||
3166 | "Read from index %zd failed, continuing\n", | ||
3167 | i ); | ||
3168 | continue; | ||
3169 | } | ||
3170 | |||
3171 | /* Test for garbage */ | ||
3172 | pdaok = 1; /* initially assume good */ | ||
3173 | morepdrs = 1; | ||
3174 | while ( pdaok && morepdrs ) { | ||
3175 | pdrlen = hfa384x2host_16(pda[currpdr]) * 2; | ||
3176 | pdrcode = hfa384x2host_16(pda[currpdr+1]); | ||
3177 | /* Test the record length */ | ||
3178 | if ( pdrlen > HFA384x_PDR_LEN_MAX || pdrlen == 0) { | ||
3179 | WLAN_LOG_ERROR("pdrlen invalid=%d\n", | ||
3180 | pdrlen); | ||
3181 | pdaok = 0; | ||
3182 | break; | ||
3183 | } | ||
3184 | /* Test the code */ | ||
3185 | if ( !hfa384x_isgood_pdrcode(pdrcode) ) { | ||
3186 | WLAN_LOG_ERROR("pdrcode invalid=%d\n", | ||
3187 | pdrcode); | ||
3188 | pdaok = 0; | ||
3189 | break; | ||
3190 | } | ||
3191 | /* Test for completion */ | ||
3192 | if ( pdrcode == HFA384x_PDR_END_OF_PDA) { | ||
3193 | morepdrs = 0; | ||
3194 | } | ||
3195 | |||
3196 | /* Move to the next pdr (if necessary) */ | ||
3197 | if ( morepdrs ) { | ||
3198 | /* note the access to pda[], need words here */ | ||
3199 | currpdr += hfa384x2host_16(pda[currpdr]) + 1; | ||
3200 | } | ||
3201 | } | ||
3202 | if ( pdaok ) { | ||
3203 | WLAN_LOG_INFO( | ||
3204 | "PDA Read from 0x%08x in %s space.\n", | ||
3205 | pdaloc[i].cardaddr, | ||
3206 | pdaloc[i].auxctl == 0 ? "EXTDS" : | ||
3207 | pdaloc[i].auxctl == 1 ? "NV" : | ||
3208 | pdaloc[i].auxctl == 2 ? "PHY" : | ||
3209 | pdaloc[i].auxctl == 3 ? "ICSRAM" : | ||
3210 | "<bogus auxctl>"); | ||
3211 | break; | ||
3212 | } | ||
3213 | } | ||
3214 | result = pdaok ? 0 : -ENODATA; | ||
3215 | |||
3216 | if ( result ) { | ||
3217 | WLAN_LOG_DEBUG(3,"Failure: pda is not okay\n"); | ||
3218 | } | ||
3219 | |||
3220 | DBFEXIT; | ||
3221 | return result; | ||
3222 | } | ||
3223 | |||
3224 | |||
3225 | /*---------------------------------------------------------------- | ||
3226 | * hfa384x_drvr_setconfig | ||
3227 | * | ||
3228 | * Performs the sequence necessary to write a config/info item. | ||
3229 | * | ||
3230 | * Arguments: | ||
3231 | * hw device structure | ||
3232 | * rid config/info record id (in host order) | ||
3233 | * buf host side record buffer | ||
3234 | * len buffer length (in bytes) | ||
3235 | * | ||
3236 | * Returns: | ||
3237 | * 0 success | ||
3238 | * >0 f/w reported error - f/w status code | ||
3239 | * <0 driver reported error | ||
3240 | * | ||
3241 | * Side effects: | ||
3242 | * | ||
3243 | * Call context: | ||
3244 | * process | ||
3245 | ----------------------------------------------------------------*/ | ||
3246 | int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) | ||
3247 | { | ||
3248 | return hfa384x_dowrid_wait(hw, rid, buf, len); | ||
3249 | } | ||
3250 | |||
3251 | /*---------------------------------------------------------------- | ||
3252 | * hfa384x_drvr_start | ||
3253 | * | ||
3254 | * Issues the MAC initialize command, sets up some data structures, | ||
3255 | * and enables the interrupts. After this function completes, the | ||
3256 | * low-level stuff should be ready for any/all commands. | ||
3257 | * | ||
3258 | * Arguments: | ||
3259 | * hw device structure | ||
3260 | * Returns: | ||
3261 | * 0 success | ||
3262 | * >0 f/w reported error - f/w status code | ||
3263 | * <0 driver reported error | ||
3264 | * | ||
3265 | * Side effects: | ||
3266 | * | ||
3267 | * Call context: | ||
3268 | * process | ||
3269 | ----------------------------------------------------------------*/ | ||
3270 | int hfa384x_drvr_start(hfa384x_t *hw) | ||
3271 | { | ||
3272 | int result; | ||
3273 | DBFENTER; | ||
3274 | |||
3275 | might_sleep(); | ||
3276 | |||
3277 | if (usb_clear_halt(hw->usb, hw->endp_in)) { | ||
3278 | WLAN_LOG_ERROR( | ||
3279 | "Failed to reset bulk in endpoint.\n"); | ||
3280 | } | ||
3281 | |||
3282 | if (usb_clear_halt(hw->usb, hw->endp_out)) { | ||
3283 | WLAN_LOG_ERROR( | ||
3284 | "Failed to reset bulk out endpoint.\n"); | ||
3285 | } | ||
3286 | |||
3287 | /* Synchronous unlink, in case we're trying to restart the driver */ | ||
3288 | usb_kill_urb(&hw->rx_urb); | ||
3289 | |||
3290 | /* Post the IN urb */ | ||
3291 | result = submit_rx_urb(hw, GFP_KERNEL); | ||
3292 | if (result != 0) { | ||
3293 | WLAN_LOG_ERROR( | ||
3294 | "Fatal, failed to submit RX URB, result=%d\n", | ||
3295 | result); | ||
3296 | goto done; | ||
3297 | } | ||
3298 | |||
3299 | /* call initialize */ | ||
3300 | result = hfa384x_cmd_initialize(hw); | ||
3301 | if (result != 0) { | ||
3302 | usb_kill_urb(&hw->rx_urb); | ||
3303 | WLAN_LOG_ERROR( | ||
3304 | "cmd_initialize() failed, result=%d\n", | ||
3305 | result); | ||
3306 | goto done; | ||
3307 | } | ||
3308 | |||
3309 | hw->state = HFA384x_STATE_RUNNING; | ||
3310 | |||
3311 | done: | ||
3312 | DBFEXIT; | ||
3313 | return result; | ||
3314 | } | ||
3315 | |||
3316 | |||
3317 | /*---------------------------------------------------------------- | ||
3318 | * hfa384x_drvr_stop | ||
3319 | * | ||
3320 | * Shuts down the MAC to the point where it is safe to unload the | ||
3321 | * driver. Any subsystem that may be holding a data or function | ||
3322 | * ptr into the driver must be cleared/deinitialized. | ||
3323 | * | ||
3324 | * Arguments: | ||
3325 | * hw device structure | ||
3326 | * Returns: | ||
3327 | * 0 success | ||
3328 | * >0 f/w reported error - f/w status code | ||
3329 | * <0 driver reported error | ||
3330 | * | ||
3331 | * Side effects: | ||
3332 | * | ||
3333 | * Call context: | ||
3334 | * process | ||
3335 | ----------------------------------------------------------------*/ | ||
3336 | int | ||
3337 | hfa384x_drvr_stop(hfa384x_t *hw) | ||
3338 | { | ||
3339 | int result = 0; | ||
3340 | int i; | ||
3341 | DBFENTER; | ||
3342 | |||
3343 | might_sleep(); | ||
3344 | |||
3345 | /* There's no need for spinlocks here. The USB "disconnect" | ||
3346 | * function sets this "removed" flag and then calls us. | ||
3347 | */ | ||
3348 | if ( !hw->wlandev->hwremoved ) { | ||
3349 | /* Call initialize to leave the MAC in its 'reset' state */ | ||
3350 | hfa384x_cmd_initialize(hw); | ||
3351 | |||
3352 | /* Cancel the rxurb */ | ||
3353 | usb_kill_urb(&hw->rx_urb); | ||
3354 | } | ||
3355 | |||
3356 | hw->link_status = HFA384x_LINK_NOTCONNECTED; | ||
3357 | hw->state = HFA384x_STATE_INIT; | ||
3358 | |||
3359 | del_timer_sync(&hw->commsqual_timer); | ||
3360 | |||
3361 | /* Clear all the port status */ | ||
3362 | for ( i = 0; i < HFA384x_NUMPORTS_MAX; i++) { | ||
3363 | hw->port_enabled[i] = 0; | ||
3364 | } | ||
3365 | |||
3366 | DBFEXIT; | ||
3367 | return result; | ||
3368 | } | ||
3369 | |||
3370 | /*---------------------------------------------------------------- | ||
3371 | * hfa384x_drvr_txframe | ||
3372 | * | ||
3373 | * Takes a frame from prism2sta and queues it for transmission. | ||
3374 | * | ||
3375 | * Arguments: | ||
3376 | * hw device structure | ||
3377 | * skb packet buffer struct. Contains an 802.11 | ||
3378 | * data frame. | ||
3379 | * p80211_hdr points to the 802.11 header for the packet. | ||
3380 | * Returns: | ||
3381 | * 0 Success and more buffs available | ||
3382 | * 1 Success but no more buffs | ||
3383 | * 2 Allocation failure | ||
3384 | * 4 Buffer full or queue busy | ||
3385 | * | ||
3386 | * Side effects: | ||
3387 | * | ||
3388 | * Call context: | ||
3389 | * interrupt | ||
3390 | ----------------------------------------------------------------*/ | ||
3391 | int hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep) | ||
3392 | |||
3393 | { | ||
3394 | int usbpktlen = sizeof(hfa384x_tx_frame_t); | ||
3395 | int result; | ||
3396 | int ret; | ||
3397 | char *ptr; | ||
3398 | |||
3399 | DBFENTER; | ||
3400 | |||
3401 | if (hw->tx_urb.status == -EINPROGRESS) { | ||
3402 | WLAN_LOG_WARNING("TX URB already in use\n"); | ||
3403 | result = 3; | ||
3404 | goto exit; | ||
3405 | } | ||
3406 | |||
3407 | /* Build Tx frame structure */ | ||
3408 | /* Set up the control field */ | ||
3409 | memset(&hw->txbuff.txfrm.desc, 0, sizeof(hw->txbuff.txfrm.desc)); | ||
3410 | |||
3411 | /* Setup the usb type field */ | ||
3412 | hw->txbuff.type = host2hfa384x_16(HFA384x_USB_TXFRM); | ||
3413 | |||
3414 | /* Set up the sw_support field to identify this frame */ | ||
3415 | hw->txbuff.txfrm.desc.sw_support = 0x0123; | ||
3416 | |||
3417 | /* Tx complete and Tx exception disable per dleach. Might be causing | ||
3418 | * buf depletion | ||
3419 | */ | ||
3420 | //#define DOEXC SLP -- doboth breaks horribly under load, doexc less so. | ||
3421 | #if defined(DOBOTH) | ||
3422 | hw->txbuff.txfrm.desc.tx_control = | ||
3423 | HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | | ||
3424 | HFA384x_TX_TXEX_SET(1) | HFA384x_TX_TXOK_SET(1); | ||
3425 | #elif defined(DOEXC) | ||
3426 | hw->txbuff.txfrm.desc.tx_control = | ||
3427 | HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | | ||
3428 | HFA384x_TX_TXEX_SET(1) | HFA384x_TX_TXOK_SET(0); | ||
3429 | #else | ||
3430 | hw->txbuff.txfrm.desc.tx_control = | ||
3431 | HFA384x_TX_MACPORT_SET(0) | HFA384x_TX_STRUCTYPE_SET(1) | | ||
3432 | HFA384x_TX_TXEX_SET(0) | HFA384x_TX_TXOK_SET(0); | ||
3433 | #endif | ||
3434 | hw->txbuff.txfrm.desc.tx_control = | ||
3435 | host2hfa384x_16(hw->txbuff.txfrm.desc.tx_control); | ||
3436 | |||
3437 | /* copy the header over to the txdesc */ | ||
3438 | memcpy(&(hw->txbuff.txfrm.desc.frame_control), p80211_hdr, sizeof(p80211_hdr_t)); | ||
3439 | |||
3440 | /* if we're using host WEP, increase size by IV+ICV */ | ||
3441 | if (p80211_wep->data) { | ||
3442 | hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len+8); | ||
3443 | // hw->txbuff.txfrm.desc.tx_control |= HFA384x_TX_NOENCRYPT_SET(1); | ||
3444 | usbpktlen+=8; | ||
3445 | } else { | ||
3446 | hw->txbuff.txfrm.desc.data_len = host2hfa384x_16(skb->len); | ||
3447 | } | ||
3448 | |||
3449 | usbpktlen += skb->len; | ||
3450 | |||
3451 | /* copy over the WEP IV if we are using host WEP */ | ||
3452 | ptr = hw->txbuff.txfrm.data; | ||
3453 | if (p80211_wep->data) { | ||
3454 | memcpy(ptr, p80211_wep->iv, sizeof(p80211_wep->iv)); | ||
3455 | ptr+= sizeof(p80211_wep->iv); | ||
3456 | memcpy(ptr, p80211_wep->data, skb->len); | ||
3457 | } else { | ||
3458 | memcpy(ptr, skb->data, skb->len); | ||
3459 | } | ||
3460 | /* copy over the packet data */ | ||
3461 | ptr+= skb->len; | ||
3462 | |||
3463 | /* copy over the WEP ICV if we are using host WEP */ | ||
3464 | if (p80211_wep->data) { | ||
3465 | memcpy(ptr, p80211_wep->icv, sizeof(p80211_wep->icv)); | ||
3466 | } | ||
3467 | |||
3468 | /* Send the USB packet */ | ||
3469 | usb_fill_bulk_urb( &(hw->tx_urb), hw->usb, | ||
3470 | hw->endp_out, | ||
3471 | &(hw->txbuff), ROUNDUP64(usbpktlen), | ||
3472 | hfa384x_usbout_callback, hw->wlandev ); | ||
3473 | hw->tx_urb.transfer_flags |= USB_QUEUE_BULK; | ||
3474 | |||
3475 | result = 1; | ||
3476 | ret = submit_tx_urb(hw, &hw->tx_urb, GFP_ATOMIC); | ||
3477 | if ( ret != 0 ) { | ||
3478 | WLAN_LOG_ERROR( | ||
3479 | "submit_tx_urb() failed, error=%d\n", ret); | ||
3480 | result = 3; | ||
3481 | } | ||
3482 | |||
3483 | exit: | ||
3484 | DBFEXIT; | ||
3485 | return result; | ||
3486 | } | ||
3487 | |||
3488 | void hfa384x_tx_timeout(wlandevice_t *wlandev) | ||
3489 | { | ||
3490 | hfa384x_t *hw = wlandev->priv; | ||
3491 | unsigned long flags; | ||
3492 | |||
3493 | DBFENTER; | ||
3494 | |||
3495 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
3496 | |||
3497 | if ( !hw->wlandev->hwremoved && | ||
3498 | /* Note the bitwise OR, not the logical OR. */ | ||
3499 | ( !test_and_set_bit(WORK_TX_HALT, &hw->usb_flags) | | ||
3500 | !test_and_set_bit(WORK_RX_HALT, &hw->usb_flags) ) ) | ||
3501 | { | ||
3502 | schedule_work(&hw->usb_work); | ||
3503 | } | ||
3504 | |||
3505 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
3506 | |||
3507 | DBFEXIT; | ||
3508 | } | ||
3509 | |||
3510 | /*---------------------------------------------------------------- | ||
3511 | * hfa384x_usbctlx_reaper_task | ||
3512 | * | ||
3513 | * Tasklet to delete dead CTLX objects | ||
3514 | * | ||
3515 | * Arguments: | ||
3516 | * data ptr to a hfa384x_t | ||
3517 | * | ||
3518 | * Returns: | ||
3519 | * | ||
3520 | * Call context: | ||
3521 | * Interrupt | ||
3522 | ----------------------------------------------------------------*/ | ||
3523 | static void hfa384x_usbctlx_reaper_task(unsigned long data) | ||
3524 | { | ||
3525 | hfa384x_t *hw = (hfa384x_t*)data; | ||
3526 | struct list_head *entry; | ||
3527 | struct list_head *temp; | ||
3528 | unsigned long flags; | ||
3529 | |||
3530 | DBFENTER; | ||
3531 | |||
3532 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
3533 | |||
3534 | /* This list is guaranteed to be empty if someone | ||
3535 | * has unplugged the adapter. | ||
3536 | */ | ||
3537 | list_for_each_safe(entry, temp, &hw->ctlxq.reapable) { | ||
3538 | hfa384x_usbctlx_t *ctlx; | ||
3539 | |||
3540 | ctlx = list_entry(entry, hfa384x_usbctlx_t, list); | ||
3541 | list_del(&ctlx->list); | ||
3542 | kfree(ctlx); | ||
3543 | } | ||
3544 | |||
3545 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
3546 | |||
3547 | DBFEXIT; | ||
3548 | } | ||
3549 | |||
3550 | /*---------------------------------------------------------------- | ||
3551 | * hfa384x_usbctlx_completion_task | ||
3552 | * | ||
3553 | * Tasklet to call completion handlers for returned CTLXs | ||
3554 | * | ||
3555 | * Arguments: | ||
3556 | * data ptr to hfa384x_t | ||
3557 | * | ||
3558 | * Returns: | ||
3559 | * Nothing | ||
3560 | * | ||
3561 | * Call context: | ||
3562 | * Interrupt | ||
3563 | ----------------------------------------------------------------*/ | ||
3564 | static void hfa384x_usbctlx_completion_task(unsigned long data) | ||
3565 | { | ||
3566 | hfa384x_t *hw = (hfa384x_t*)data; | ||
3567 | struct list_head *entry; | ||
3568 | struct list_head *temp; | ||
3569 | unsigned long flags; | ||
3570 | |||
3571 | int reap = 0; | ||
3572 | |||
3573 | DBFENTER; | ||
3574 | |||
3575 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
3576 | |||
3577 | /* This list is guaranteed to be empty if someone | ||
3578 | * has unplugged the adapter ... | ||
3579 | */ | ||
3580 | list_for_each_safe(entry, temp, &hw->ctlxq.completing) { | ||
3581 | hfa384x_usbctlx_t *ctlx; | ||
3582 | |||
3583 | ctlx = list_entry(entry, hfa384x_usbctlx_t, list); | ||
3584 | |||
3585 | /* Call the completion function that this | ||
3586 | * command was assigned, assuming it has one. | ||
3587 | */ | ||
3588 | if ( ctlx->cmdcb != NULL ) { | ||
3589 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
3590 | ctlx->cmdcb(hw, ctlx); | ||
3591 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
3592 | |||
3593 | /* Make sure we don't try and complete | ||
3594 | * this CTLX more than once! | ||
3595 | */ | ||
3596 | ctlx->cmdcb = NULL; | ||
3597 | |||
3598 | /* Did someone yank the adapter out | ||
3599 | * while our list was (briefly) unlocked? | ||
3600 | */ | ||
3601 | if ( hw->wlandev->hwremoved ) | ||
3602 | { | ||
3603 | reap = 0; | ||
3604 | break; | ||
3605 | } | ||
3606 | } | ||
3607 | |||
3608 | /* | ||
3609 | * "Reapable" CTLXs are ones which don't have any | ||
3610 | * threads waiting for them to die. Hence they must | ||
3611 | * be delivered to The Reaper! | ||
3612 | */ | ||
3613 | if ( ctlx->reapable ) { | ||
3614 | /* Move the CTLX off the "completing" list (hopefully) | ||
3615 | * on to the "reapable" list where the reaper task | ||
3616 | * can find it. And "reapable" means that this CTLX | ||
3617 | * isn't sitting on a wait-queue somewhere. | ||
3618 | */ | ||
3619 | list_move_tail(&ctlx->list, &hw->ctlxq.reapable); | ||
3620 | reap = 1; | ||
3621 | } | ||
3622 | |||
3623 | complete(&ctlx->done); | ||
3624 | } | ||
3625 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
3626 | |||
3627 | if (reap) | ||
3628 | tasklet_schedule(&hw->reaper_bh); | ||
3629 | |||
3630 | DBFEXIT; | ||
3631 | } | ||
3632 | |||
3633 | /*---------------------------------------------------------------- | ||
3634 | * unlocked_usbctlx_cancel_async | ||
3635 | * | ||
3636 | * Mark the CTLX dead asynchronously, and ensure that the | ||
3637 | * next command on the queue is run afterwards. | ||
3638 | * | ||
3639 | * Arguments: | ||
3640 | * hw ptr to the hfa384x_t structure | ||
3641 | * ctlx ptr to a CTLX structure | ||
3642 | * | ||
3643 | * Returns: | ||
3644 | * 0 the CTLX's URB is inactive | ||
3645 | * -EINPROGRESS the URB is currently being unlinked | ||
3646 | * | ||
3647 | * Call context: | ||
3648 | * Either process or interrupt, but presumably interrupt | ||
3649 | ----------------------------------------------------------------*/ | ||
3650 | static int unlocked_usbctlx_cancel_async(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx) | ||
3651 | { | ||
3652 | int ret; | ||
3653 | |||
3654 | DBFENTER; | ||
3655 | |||
3656 | /* | ||
3657 | * Try to delete the URB containing our request packet. | ||
3658 | * If we succeed, then its completion handler will be | ||
3659 | * called with a status of -ECONNRESET. | ||
3660 | */ | ||
3661 | hw->ctlx_urb.transfer_flags |= URB_ASYNC_UNLINK; | ||
3662 | ret = usb_unlink_urb(&hw->ctlx_urb); | ||
3663 | |||
3664 | if (ret != -EINPROGRESS) { | ||
3665 | /* | ||
3666 | * The OUT URB had either already completed | ||
3667 | * or was still in the pending queue, so the | ||
3668 | * URB's completion function will not be called. | ||
3669 | * We will have to complete the CTLX ourselves. | ||
3670 | */ | ||
3671 | ctlx->state = CTLX_REQ_FAILED; | ||
3672 | unlocked_usbctlx_complete(hw, ctlx); | ||
3673 | ret = 0; | ||
3674 | } | ||
3675 | |||
3676 | DBFEXIT; | ||
3677 | |||
3678 | return ret; | ||
3679 | } | ||
3680 | |||
3681 | /*---------------------------------------------------------------- | ||
3682 | * unlocked_usbctlx_complete | ||
3683 | * | ||
3684 | * A CTLX has completed. It may have been successful, it may not | ||
3685 | * have been. At this point, the CTLX should be quiescent. The URBs | ||
3686 | * aren't active and the timers should have been stopped. | ||
3687 | * | ||
3688 | * The CTLX is migrated to the "completing" queue, and the completing | ||
3689 | * tasklet is scheduled. | ||
3690 | * | ||
3691 | * Arguments: | ||
3692 | * hw ptr to a hfa384x_t structure | ||
3693 | * ctlx ptr to a ctlx structure | ||
3694 | * | ||
3695 | * Returns: | ||
3696 | * nothing | ||
3697 | * | ||
3698 | * Side effects: | ||
3699 | * | ||
3700 | * Call context: | ||
3701 | * Either, assume interrupt | ||
3702 | ----------------------------------------------------------------*/ | ||
3703 | static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx) | ||
3704 | { | ||
3705 | DBFENTER; | ||
3706 | |||
3707 | /* Timers have been stopped, and ctlx should be in | ||
3708 | * a terminal state. Retire it from the "active" | ||
3709 | * queue. | ||
3710 | */ | ||
3711 | list_move_tail(&ctlx->list, &hw->ctlxq.completing); | ||
3712 | tasklet_schedule(&hw->completion_bh); | ||
3713 | |||
3714 | switch (ctlx->state) { | ||
3715 | case CTLX_COMPLETE: | ||
3716 | case CTLX_REQ_FAILED: | ||
3717 | /* This are the correct terminating states. */ | ||
3718 | break; | ||
3719 | |||
3720 | default: | ||
3721 | WLAN_LOG_ERROR("CTLX[%d] not in a terminating state(%s)\n", | ||
3722 | hfa384x2host_16(ctlx->outbuf.type), | ||
3723 | ctlxstr(ctlx->state)); | ||
3724 | break; | ||
3725 | } /* switch */ | ||
3726 | |||
3727 | DBFEXIT; | ||
3728 | } | ||
3729 | |||
3730 | /*---------------------------------------------------------------- | ||
3731 | * hfa384x_usbctlxq_run | ||
3732 | * | ||
3733 | * Checks to see if the head item is running. If not, starts it. | ||
3734 | * | ||
3735 | * Arguments: | ||
3736 | * hw ptr to hfa384x_t | ||
3737 | * | ||
3738 | * Returns: | ||
3739 | * nothing | ||
3740 | * | ||
3741 | * Side effects: | ||
3742 | * | ||
3743 | * Call context: | ||
3744 | * any | ||
3745 | ----------------------------------------------------------------*/ | ||
3746 | static void | ||
3747 | hfa384x_usbctlxq_run(hfa384x_t *hw) | ||
3748 | { | ||
3749 | unsigned long flags; | ||
3750 | DBFENTER; | ||
3751 | |||
3752 | /* acquire lock */ | ||
3753 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
3754 | |||
3755 | /* Only one active CTLX at any one time, because there's no | ||
3756 | * other (reliable) way to match the response URB to the | ||
3757 | * correct CTLX. | ||
3758 | * | ||
3759 | * Don't touch any of these CTLXs if the hardware | ||
3760 | * has been removed or the USB subsystem is stalled. | ||
3761 | */ | ||
3762 | if ( !list_empty(&hw->ctlxq.active) || | ||
3763 | test_bit(WORK_TX_HALT, &hw->usb_flags) || | ||
3764 | hw->wlandev->hwremoved ) | ||
3765 | goto unlock; | ||
3766 | |||
3767 | while ( !list_empty(&hw->ctlxq.pending) ) { | ||
3768 | hfa384x_usbctlx_t *head; | ||
3769 | int result; | ||
3770 | |||
3771 | /* This is the first pending command */ | ||
3772 | head = list_entry(hw->ctlxq.pending.next, | ||
3773 | hfa384x_usbctlx_t, | ||
3774 | list); | ||
3775 | |||
3776 | /* We need to split this off to avoid a race condition */ | ||
3777 | list_move_tail(&head->list, &hw->ctlxq.active); | ||
3778 | |||
3779 | /* Fill the out packet */ | ||
3780 | usb_fill_bulk_urb( &(hw->ctlx_urb), hw->usb, | ||
3781 | hw->endp_out, | ||
3782 | &(head->outbuf), ROUNDUP64(head->outbufsize), | ||
3783 | hfa384x_ctlxout_callback, hw); | ||
3784 | hw->ctlx_urb.transfer_flags |= USB_QUEUE_BULK; | ||
3785 | |||
3786 | /* Now submit the URB and update the CTLX's state | ||
3787 | */ | ||
3788 | if ((result = SUBMIT_URB(&hw->ctlx_urb, GFP_ATOMIC)) == 0) { | ||
3789 | /* This CTLX is now running on the active queue */ | ||
3790 | head->state = CTLX_REQ_SUBMITTED; | ||
3791 | |||
3792 | /* Start the OUT wait timer */ | ||
3793 | hw->req_timer_done = 0; | ||
3794 | hw->reqtimer.expires = jiffies + HZ; | ||
3795 | add_timer(&hw->reqtimer); | ||
3796 | |||
3797 | /* Start the IN wait timer */ | ||
3798 | hw->resp_timer_done = 0; | ||
3799 | hw->resptimer.expires = jiffies + 2*HZ; | ||
3800 | add_timer(&hw->resptimer); | ||
3801 | |||
3802 | break; | ||
3803 | } | ||
3804 | |||
3805 | if (result == -EPIPE) { | ||
3806 | /* The OUT pipe needs resetting, so put | ||
3807 | * this CTLX back in the "pending" queue | ||
3808 | * and schedule a reset ... | ||
3809 | */ | ||
3810 | WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n", | ||
3811 | hw->wlandev->netdev->name); | ||
3812 | list_move(&head->list, &hw->ctlxq.pending); | ||
3813 | set_bit(WORK_TX_HALT, &hw->usb_flags); | ||
3814 | schedule_work(&hw->usb_work); | ||
3815 | break; | ||
3816 | } | ||
3817 | |||
3818 | if (result == -ESHUTDOWN) { | ||
3819 | WLAN_LOG_WARNING("%s urb shutdown!\n", | ||
3820 | hw->wlandev->netdev->name); | ||
3821 | break; | ||
3822 | } | ||
3823 | |||
3824 | WLAN_LOG_ERROR("Failed to submit CTLX[%d]: error=%d\n", | ||
3825 | hfa384x2host_16(head->outbuf.type), result); | ||
3826 | unlocked_usbctlx_complete(hw, head); | ||
3827 | } /* while */ | ||
3828 | |||
3829 | unlock: | ||
3830 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
3831 | |||
3832 | DBFEXIT; | ||
3833 | } | ||
3834 | |||
3835 | |||
3836 | /*---------------------------------------------------------------- | ||
3837 | * hfa384x_usbin_callback | ||
3838 | * | ||
3839 | * Callback for URBs on the BULKIN endpoint. | ||
3840 | * | ||
3841 | * Arguments: | ||
3842 | * urb ptr to the completed urb | ||
3843 | * | ||
3844 | * Returns: | ||
3845 | * nothing | ||
3846 | * | ||
3847 | * Side effects: | ||
3848 | * | ||
3849 | * Call context: | ||
3850 | * interrupt | ||
3851 | ----------------------------------------------------------------*/ | ||
3852 | #ifdef URB_ONLY_CALLBACK | ||
3853 | static void hfa384x_usbin_callback(struct urb *urb) | ||
3854 | #else | ||
3855 | static void hfa384x_usbin_callback(struct urb *urb, struct pt_regs *regs) | ||
3856 | #endif | ||
3857 | { | ||
3858 | wlandevice_t *wlandev = urb->context; | ||
3859 | hfa384x_t *hw; | ||
3860 | hfa384x_usbin_t *usbin = (hfa384x_usbin_t *) urb->transfer_buffer; | ||
3861 | struct sk_buff *skb = NULL; | ||
3862 | int result; | ||
3863 | int urb_status; | ||
3864 | UINT16 type; | ||
3865 | |||
3866 | enum USBIN_ACTION { | ||
3867 | HANDLE, | ||
3868 | RESUBMIT, | ||
3869 | ABORT | ||
3870 | } action; | ||
3871 | |||
3872 | DBFENTER; | ||
3873 | |||
3874 | if ( !wlandev || | ||
3875 | !wlandev->netdev || | ||
3876 | !netif_device_present(wlandev->netdev) ) | ||
3877 | goto exit; | ||
3878 | |||
3879 | hw = wlandev->priv; | ||
3880 | if (!hw) | ||
3881 | goto exit; | ||
3882 | |||
3883 | skb = hw->rx_urb_skb; | ||
3884 | if (!skb || (skb->data != urb->transfer_buffer)) { | ||
3885 | BUG(); | ||
3886 | } | ||
3887 | hw->rx_urb_skb = NULL; | ||
3888 | |||
3889 | /* Check for error conditions within the URB */ | ||
3890 | switch (urb->status) { | ||
3891 | case 0: | ||
3892 | action = HANDLE; | ||
3893 | |||
3894 | /* Check for short packet */ | ||
3895 | if ( urb->actual_length == 0 ) { | ||
3896 | ++(wlandev->linux_stats.rx_errors); | ||
3897 | ++(wlandev->linux_stats.rx_length_errors); | ||
3898 | action = RESUBMIT; | ||
3899 | } | ||
3900 | break; | ||
3901 | |||
3902 | case -EPIPE: | ||
3903 | WLAN_LOG_WARNING("%s rx pipe stalled: requesting reset\n", | ||
3904 | wlandev->netdev->name); | ||
3905 | if ( !test_and_set_bit(WORK_RX_HALT, &hw->usb_flags) ) | ||
3906 | schedule_work(&hw->usb_work); | ||
3907 | ++(wlandev->linux_stats.rx_errors); | ||
3908 | action = ABORT; | ||
3909 | break; | ||
3910 | |||
3911 | case -EILSEQ: | ||
3912 | case -ETIMEDOUT: | ||
3913 | case -EPROTO: | ||
3914 | if ( !test_and_set_bit(THROTTLE_RX, &hw->usb_flags) && | ||
3915 | !timer_pending(&hw->throttle) ) { | ||
3916 | mod_timer(&hw->throttle, jiffies + THROTTLE_JIFFIES); | ||
3917 | } | ||
3918 | ++(wlandev->linux_stats.rx_errors); | ||
3919 | action = ABORT; | ||
3920 | break; | ||
3921 | |||
3922 | case -EOVERFLOW: | ||
3923 | ++(wlandev->linux_stats.rx_over_errors); | ||
3924 | action = RESUBMIT; | ||
3925 | break; | ||
3926 | |||
3927 | case -ENODEV: | ||
3928 | case -ESHUTDOWN: | ||
3929 | WLAN_LOG_DEBUG(3,"status=%d, device removed.\n", urb->status); | ||
3930 | action = ABORT; | ||
3931 | break; | ||
3932 | |||
3933 | case -ENOENT: | ||
3934 | case -ECONNRESET: | ||
3935 | WLAN_LOG_DEBUG(3,"status=%d, urb explicitly unlinked.\n", urb->status); | ||
3936 | action = ABORT; | ||
3937 | break; | ||
3938 | |||
3939 | default: | ||
3940 | WLAN_LOG_DEBUG(3,"urb status=%d, transfer flags=0x%x\n", | ||
3941 | urb->status, urb->transfer_flags); | ||
3942 | ++(wlandev->linux_stats.rx_errors); | ||
3943 | action = RESUBMIT; | ||
3944 | break; | ||
3945 | } | ||
3946 | |||
3947 | urb_status = urb->status; | ||
3948 | |||
3949 | if (action != ABORT) { | ||
3950 | /* Repost the RX URB */ | ||
3951 | result = submit_rx_urb(hw, GFP_ATOMIC); | ||
3952 | |||
3953 | if (result != 0) { | ||
3954 | WLAN_LOG_ERROR( | ||
3955 | "Fatal, failed to resubmit rx_urb. error=%d\n", | ||
3956 | result); | ||
3957 | } | ||
3958 | } | ||
3959 | |||
3960 | /* Handle any USB-IN packet */ | ||
3961 | /* Note: the check of the sw_support field, the type field doesn't | ||
3962 | * have bit 12 set like the docs suggest. | ||
3963 | */ | ||
3964 | type = hfa384x2host_16(usbin->type); | ||
3965 | if (HFA384x_USB_ISRXFRM(type)) { | ||
3966 | if (action == HANDLE) { | ||
3967 | if (usbin->txfrm.desc.sw_support == 0x0123) { | ||
3968 | hfa384x_usbin_txcompl(wlandev, usbin); | ||
3969 | } else { | ||
3970 | skb_put(skb, sizeof(*usbin)); | ||
3971 | hfa384x_usbin_rx(wlandev, skb); | ||
3972 | skb = NULL; | ||
3973 | } | ||
3974 | } | ||
3975 | goto exit; | ||
3976 | } | ||
3977 | if (HFA384x_USB_ISTXFRM(type)) { | ||
3978 | if (action == HANDLE) | ||
3979 | hfa384x_usbin_txcompl(wlandev, usbin); | ||
3980 | goto exit; | ||
3981 | } | ||
3982 | switch (type) { | ||
3983 | case HFA384x_USB_INFOFRM: | ||
3984 | if (action == ABORT) | ||
3985 | goto exit; | ||
3986 | if (action == HANDLE) | ||
3987 | hfa384x_usbin_info(wlandev, usbin); | ||
3988 | break; | ||
3989 | |||
3990 | case HFA384x_USB_CMDRESP: | ||
3991 | case HFA384x_USB_WRIDRESP: | ||
3992 | case HFA384x_USB_RRIDRESP: | ||
3993 | case HFA384x_USB_WMEMRESP: | ||
3994 | case HFA384x_USB_RMEMRESP: | ||
3995 | /* ALWAYS, ALWAYS, ALWAYS handle this CTLX!!!! */ | ||
3996 | hfa384x_usbin_ctlx(hw, usbin, urb_status); | ||
3997 | break; | ||
3998 | |||
3999 | case HFA384x_USB_BUFAVAIL: | ||
4000 | WLAN_LOG_DEBUG(3,"Received BUFAVAIL packet, frmlen=%d\n", | ||
4001 | usbin->bufavail.frmlen); | ||
4002 | break; | ||
4003 | |||
4004 | case HFA384x_USB_ERROR: | ||
4005 | WLAN_LOG_DEBUG(3,"Received USB_ERROR packet, errortype=%d\n", | ||
4006 | usbin->usberror.errortype); | ||
4007 | break; | ||
4008 | |||
4009 | default: | ||
4010 | WLAN_LOG_DEBUG(3,"Unrecognized USBIN packet, type=%x, status=%d\n", | ||
4011 | usbin->type, urb_status); | ||
4012 | break; | ||
4013 | } /* switch */ | ||
4014 | |||
4015 | exit: | ||
4016 | |||
4017 | if (skb) | ||
4018 | dev_kfree_skb(skb); | ||
4019 | |||
4020 | DBFEXIT; | ||
4021 | } | ||
4022 | |||
4023 | |||
4024 | /*---------------------------------------------------------------- | ||
4025 | * hfa384x_usbin_ctlx | ||
4026 | * | ||
4027 | * We've received a URB containing a Prism2 "response" message. | ||
4028 | * This message needs to be matched up with a CTLX on the active | ||
4029 | * queue and our state updated accordingly. | ||
4030 | * | ||
4031 | * Arguments: | ||
4032 | * hw ptr to hfa384x_t | ||
4033 | * usbin ptr to USB IN packet | ||
4034 | * urb_status status of this Bulk-In URB | ||
4035 | * | ||
4036 | * Returns: | ||
4037 | * nothing | ||
4038 | * | ||
4039 | * Side effects: | ||
4040 | * | ||
4041 | * Call context: | ||
4042 | * interrupt | ||
4043 | ----------------------------------------------------------------*/ | ||
4044 | static void hfa384x_usbin_ctlx(hfa384x_t *hw, hfa384x_usbin_t *usbin, | ||
4045 | int urb_status) | ||
4046 | { | ||
4047 | hfa384x_usbctlx_t *ctlx; | ||
4048 | int run_queue = 0; | ||
4049 | unsigned long flags; | ||
4050 | |||
4051 | DBFENTER; | ||
4052 | |||
4053 | retry: | ||
4054 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
4055 | |||
4056 | /* There can be only one CTLX on the active queue | ||
4057 | * at any one time, and this is the CTLX that the | ||
4058 | * timers are waiting for. | ||
4059 | */ | ||
4060 | if ( list_empty(&hw->ctlxq.active) ) { | ||
4061 | goto unlock; | ||
4062 | } | ||
4063 | |||
4064 | /* Remove the "response timeout". It's possible that | ||
4065 | * we are already too late, and that the timeout is | ||
4066 | * already running. And that's just too bad for us, | ||
4067 | * because we could lose our CTLX from the active | ||
4068 | * queue here ... | ||
4069 | */ | ||
4070 | if (del_timer(&hw->resptimer) == 0) { | ||
4071 | if (hw->resp_timer_done == 0) { | ||
4072 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4073 | goto retry; | ||
4074 | } | ||
4075 | } | ||
4076 | else { | ||
4077 | hw->resp_timer_done = 1; | ||
4078 | } | ||
4079 | |||
4080 | ctlx = get_active_ctlx(hw); | ||
4081 | |||
4082 | if (urb_status != 0) { | ||
4083 | /* | ||
4084 | * Bad CTLX, so get rid of it. But we only | ||
4085 | * remove it from the active queue if we're no | ||
4086 | * longer expecting the OUT URB to complete. | ||
4087 | */ | ||
4088 | if (unlocked_usbctlx_cancel_async(hw, ctlx) == 0) | ||
4089 | run_queue = 1; | ||
4090 | } else { | ||
4091 | const UINT16 intype = (usbin->type&~host2hfa384x_16(0x8000)); | ||
4092 | |||
4093 | /* | ||
4094 | * Check that our message is what we're expecting ... | ||
4095 | */ | ||
4096 | if (ctlx->outbuf.type != intype) { | ||
4097 | WLAN_LOG_WARNING("Expected IN[%d], received IN[%d] - ignored.\n", | ||
4098 | hfa384x2host_16(ctlx->outbuf.type), | ||
4099 | hfa384x2host_16(intype)); | ||
4100 | goto unlock; | ||
4101 | } | ||
4102 | |||
4103 | /* This URB has succeeded, so grab the data ... */ | ||
4104 | memcpy(&ctlx->inbuf, usbin, sizeof(ctlx->inbuf)); | ||
4105 | |||
4106 | switch (ctlx->state) { | ||
4107 | case CTLX_REQ_SUBMITTED: | ||
4108 | /* | ||
4109 | * We have received our response URB before | ||
4110 | * our request has been acknowledged. Odd, | ||
4111 | * but our OUT URB is still alive... | ||
4112 | */ | ||
4113 | WLAN_LOG_DEBUG(0, "Causality violation: please reboot Universe, or email linux-wlan-devel@lists.linux-wlan.com\n"); | ||
4114 | ctlx->state = CTLX_RESP_COMPLETE; | ||
4115 | break; | ||
4116 | |||
4117 | case CTLX_REQ_COMPLETE: | ||
4118 | /* | ||
4119 | * This is the usual path: our request | ||
4120 | * has already been acknowledged, and | ||
4121 | * now we have received the reply too. | ||
4122 | */ | ||
4123 | ctlx->state = CTLX_COMPLETE; | ||
4124 | unlocked_usbctlx_complete(hw, ctlx); | ||
4125 | run_queue = 1; | ||
4126 | break; | ||
4127 | |||
4128 | default: | ||
4129 | /* | ||
4130 | * Throw this CTLX away ... | ||
4131 | */ | ||
4132 | WLAN_LOG_ERROR("Matched IN URB, CTLX[%d] in invalid state(%s)." | ||
4133 | " Discarded.\n", | ||
4134 | hfa384x2host_16(ctlx->outbuf.type), | ||
4135 | ctlxstr(ctlx->state)); | ||
4136 | if (unlocked_usbctlx_cancel_async(hw, ctlx) == 0) | ||
4137 | run_queue = 1; | ||
4138 | break; | ||
4139 | } /* switch */ | ||
4140 | } | ||
4141 | |||
4142 | unlock: | ||
4143 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4144 | |||
4145 | if (run_queue) | ||
4146 | hfa384x_usbctlxq_run(hw); | ||
4147 | |||
4148 | DBFEXIT; | ||
4149 | } | ||
4150 | |||
4151 | |||
4152 | /*---------------------------------------------------------------- | ||
4153 | * hfa384x_usbin_txcompl | ||
4154 | * | ||
4155 | * At this point we have the results of a previous transmit. | ||
4156 | * | ||
4157 | * Arguments: | ||
4158 | * wlandev wlan device | ||
4159 | * usbin ptr to the usb transfer buffer | ||
4160 | * | ||
4161 | * Returns: | ||
4162 | * nothing | ||
4163 | * | ||
4164 | * Side effects: | ||
4165 | * | ||
4166 | * Call context: | ||
4167 | * interrupt | ||
4168 | ----------------------------------------------------------------*/ | ||
4169 | static void hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin) | ||
4170 | { | ||
4171 | UINT16 status; | ||
4172 | DBFENTER; | ||
4173 | |||
4174 | status = hfa384x2host_16(usbin->type); /* yeah I know it says type...*/ | ||
4175 | |||
4176 | /* Was there an error? */ | ||
4177 | if (HFA384x_TXSTATUS_ISERROR(status)) { | ||
4178 | prism2sta_ev_txexc(wlandev, status); | ||
4179 | } else { | ||
4180 | prism2sta_ev_tx(wlandev, status); | ||
4181 | } | ||
4182 | // prism2sta_ev_alloc(wlandev); | ||
4183 | |||
4184 | DBFEXIT; | ||
4185 | } | ||
4186 | |||
4187 | |||
4188 | /*---------------------------------------------------------------- | ||
4189 | * hfa384x_usbin_rx | ||
4190 | * | ||
4191 | * At this point we have a successful received a rx frame packet. | ||
4192 | * | ||
4193 | * Arguments: | ||
4194 | * wlandev wlan device | ||
4195 | * usbin ptr to the usb transfer buffer | ||
4196 | * | ||
4197 | * Returns: | ||
4198 | * nothing | ||
4199 | * | ||
4200 | * Side effects: | ||
4201 | * | ||
4202 | * Call context: | ||
4203 | * interrupt | ||
4204 | ----------------------------------------------------------------*/ | ||
4205 | static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb) | ||
4206 | { | ||
4207 | hfa384x_usbin_t *usbin = (hfa384x_usbin_t *) skb->data; | ||
4208 | hfa384x_t *hw = wlandev->priv; | ||
4209 | int hdrlen; | ||
4210 | p80211_rxmeta_t *rxmeta; | ||
4211 | UINT16 data_len; | ||
4212 | UINT16 fc; | ||
4213 | |||
4214 | DBFENTER; | ||
4215 | |||
4216 | /* Byte order convert once up front. */ | ||
4217 | usbin->rxfrm.desc.status = | ||
4218 | hfa384x2host_16(usbin->rxfrm.desc.status); | ||
4219 | usbin->rxfrm.desc.time = | ||
4220 | hfa384x2host_32(usbin->rxfrm.desc.time); | ||
4221 | |||
4222 | /* Now handle frame based on port# */ | ||
4223 | switch( HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) ) | ||
4224 | { | ||
4225 | case 0: | ||
4226 | fc = ieee2host16(usbin->rxfrm.desc.frame_control); | ||
4227 | |||
4228 | /* If exclude and we receive an unencrypted, drop it */ | ||
4229 | if ( (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) && | ||
4230 | !WLAN_GET_FC_ISWEP(fc)){ | ||
4231 | goto done; | ||
4232 | } | ||
4233 | |||
4234 | data_len = hfa384x2host_16(usbin->rxfrm.desc.data_len); | ||
4235 | |||
4236 | /* How much header data do we have? */ | ||
4237 | hdrlen = p80211_headerlen(fc); | ||
4238 | |||
4239 | /* Pull off the descriptor */ | ||
4240 | skb_pull(skb, sizeof(hfa384x_rx_frame_t)); | ||
4241 | |||
4242 | /* Now shunt the header block up against the data block | ||
4243 | * with an "overlapping" copy | ||
4244 | */ | ||
4245 | memmove(skb_push(skb, hdrlen), | ||
4246 | &usbin->rxfrm.desc.frame_control, | ||
4247 | hdrlen); | ||
4248 | |||
4249 | skb->dev = wlandev->netdev; | ||
4250 | skb->dev->last_rx = jiffies; | ||
4251 | |||
4252 | /* And set the frame length properly */ | ||
4253 | skb_trim(skb, data_len + hdrlen); | ||
4254 | |||
4255 | /* The prism2 series does not return the CRC */ | ||
4256 | memset(skb_put(skb, WLAN_CRC_LEN), 0xff, WLAN_CRC_LEN); | ||
4257 | |||
4258 | skb_reset_mac_header(skb); | ||
4259 | |||
4260 | /* Attach the rxmeta, set some stuff */ | ||
4261 | p80211skb_rxmeta_attach(wlandev, skb); | ||
4262 | rxmeta = P80211SKB_RXMETA(skb); | ||
4263 | rxmeta->mactime = usbin->rxfrm.desc.time; | ||
4264 | rxmeta->rxrate = usbin->rxfrm.desc.rate; | ||
4265 | rxmeta->signal = usbin->rxfrm.desc.signal - hw->dbmadjust; | ||
4266 | rxmeta->noise = usbin->rxfrm.desc.silence - hw->dbmadjust; | ||
4267 | |||
4268 | prism2sta_ev_rx(wlandev, skb); | ||
4269 | |||
4270 | break; | ||
4271 | |||
4272 | case 7: | ||
4273 | if ( ! HFA384x_RXSTATUS_ISFCSERR(usbin->rxfrm.desc.status) ) { | ||
4274 | /* Copy to wlansnif skb */ | ||
4275 | hfa384x_int_rxmonitor( wlandev, &usbin->rxfrm); | ||
4276 | dev_kfree_skb(skb); | ||
4277 | } else { | ||
4278 | WLAN_LOG_DEBUG(3,"Received monitor frame: FCSerr set\n"); | ||
4279 | } | ||
4280 | break; | ||
4281 | |||
4282 | default: | ||
4283 | WLAN_LOG_WARNING("Received frame on unsupported port=%d\n", | ||
4284 | HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status) ); | ||
4285 | goto done; | ||
4286 | break; | ||
4287 | } | ||
4288 | |||
4289 | done: | ||
4290 | DBFEXIT; | ||
4291 | return; | ||
4292 | } | ||
4293 | |||
4294 | /*---------------------------------------------------------------- | ||
4295 | * hfa384x_int_rxmonitor | ||
4296 | * | ||
4297 | * Helper function for int_rx. Handles monitor frames. | ||
4298 | * Note that this function allocates space for the FCS and sets it | ||
4299 | * to 0xffffffff. The hfa384x doesn't give us the FCS value but the | ||
4300 | * higher layers expect it. 0xffffffff is used as a flag to indicate | ||
4301 | * the FCS is bogus. | ||
4302 | * | ||
4303 | * Arguments: | ||
4304 | * wlandev wlan device structure | ||
4305 | * rxfrm rx descriptor read from card in int_rx | ||
4306 | * | ||
4307 | * Returns: | ||
4308 | * nothing | ||
4309 | * | ||
4310 | * Side effects: | ||
4311 | * Allocates an skb and passes it up via the PF_PACKET interface. | ||
4312 | * Call context: | ||
4313 | * interrupt | ||
4314 | ----------------------------------------------------------------*/ | ||
4315 | static void hfa384x_int_rxmonitor( wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *rxfrm) | ||
4316 | { | ||
4317 | hfa384x_rx_frame_t *rxdesc = &(rxfrm->desc); | ||
4318 | UINT hdrlen = 0; | ||
4319 | UINT datalen = 0; | ||
4320 | UINT skblen = 0; | ||
4321 | p80211msg_lnxind_wlansniffrm_t *msg; | ||
4322 | UINT8 *datap; | ||
4323 | UINT16 fc; | ||
4324 | struct sk_buff *skb; | ||
4325 | hfa384x_t *hw = wlandev->priv; | ||
4326 | |||
4327 | |||
4328 | DBFENTER; | ||
4329 | /* Don't forget the status, time, and data_len fields are in host order */ | ||
4330 | /* Figure out how big the frame is */ | ||
4331 | fc = ieee2host16(rxdesc->frame_control); | ||
4332 | hdrlen = p80211_headerlen(fc); | ||
4333 | datalen = hfa384x2host_16(rxdesc->data_len); | ||
4334 | |||
4335 | /* Allocate an ind message+framesize skb */ | ||
4336 | skblen = sizeof(p80211msg_lnxind_wlansniffrm_t) + | ||
4337 | hdrlen + datalen + WLAN_CRC_LEN; | ||
4338 | |||
4339 | /* sanity check the length */ | ||
4340 | if ( skblen > | ||
4341 | (sizeof(p80211msg_lnxind_wlansniffrm_t) + | ||
4342 | WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) ) { | ||
4343 | WLAN_LOG_DEBUG(1, "overlen frm: len=%zd\n", | ||
4344 | skblen - sizeof(p80211msg_lnxind_wlansniffrm_t)); | ||
4345 | } | ||
4346 | |||
4347 | if ( (skb = dev_alloc_skb(skblen)) == NULL ) { | ||
4348 | WLAN_LOG_ERROR("alloc_skb failed trying to allocate %d bytes\n", skblen); | ||
4349 | return; | ||
4350 | } | ||
4351 | |||
4352 | /* only prepend the prism header if in the right mode */ | ||
4353 | if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) && | ||
4354 | (hw->sniffhdr == 0)) { | ||
4355 | datap = skb_put(skb, sizeof(p80211msg_lnxind_wlansniffrm_t)); | ||
4356 | msg = (p80211msg_lnxind_wlansniffrm_t*) datap; | ||
4357 | |||
4358 | /* Initialize the message members */ | ||
4359 | msg->msgcode = DIDmsg_lnxind_wlansniffrm; | ||
4360 | msg->msglen = sizeof(p80211msg_lnxind_wlansniffrm_t); | ||
4361 | strcpy(msg->devname, wlandev->name); | ||
4362 | |||
4363 | msg->hosttime.did = DIDmsg_lnxind_wlansniffrm_hosttime; | ||
4364 | msg->hosttime.status = 0; | ||
4365 | msg->hosttime.len = 4; | ||
4366 | msg->hosttime.data = jiffies; | ||
4367 | |||
4368 | msg->mactime.did = DIDmsg_lnxind_wlansniffrm_mactime; | ||
4369 | msg->mactime.status = 0; | ||
4370 | msg->mactime.len = 4; | ||
4371 | msg->mactime.data = rxdesc->time; | ||
4372 | |||
4373 | msg->channel.did = DIDmsg_lnxind_wlansniffrm_channel; | ||
4374 | msg->channel.status = 0; | ||
4375 | msg->channel.len = 4; | ||
4376 | msg->channel.data = hw->sniff_channel; | ||
4377 | |||
4378 | msg->rssi.did = DIDmsg_lnxind_wlansniffrm_rssi; | ||
4379 | msg->rssi.status = P80211ENUM_msgitem_status_no_value; | ||
4380 | msg->rssi.len = 4; | ||
4381 | msg->rssi.data = 0; | ||
4382 | |||
4383 | msg->sq.did = DIDmsg_lnxind_wlansniffrm_sq; | ||
4384 | msg->sq.status = P80211ENUM_msgitem_status_no_value; | ||
4385 | msg->sq.len = 4; | ||
4386 | msg->sq.data = 0; | ||
4387 | |||
4388 | msg->signal.did = DIDmsg_lnxind_wlansniffrm_signal; | ||
4389 | msg->signal.status = 0; | ||
4390 | msg->signal.len = 4; | ||
4391 | msg->signal.data = rxdesc->signal; | ||
4392 | |||
4393 | msg->noise.did = DIDmsg_lnxind_wlansniffrm_noise; | ||
4394 | msg->noise.status = 0; | ||
4395 | msg->noise.len = 4; | ||
4396 | msg->noise.data = rxdesc->silence; | ||
4397 | |||
4398 | msg->rate.did = DIDmsg_lnxind_wlansniffrm_rate; | ||
4399 | msg->rate.status = 0; | ||
4400 | msg->rate.len = 4; | ||
4401 | msg->rate.data = rxdesc->rate / 5; /* set to 802.11 units */ | ||
4402 | |||
4403 | msg->istx.did = DIDmsg_lnxind_wlansniffrm_istx; | ||
4404 | msg->istx.status = 0; | ||
4405 | msg->istx.len = 4; | ||
4406 | msg->istx.data = P80211ENUM_truth_false; | ||
4407 | |||
4408 | msg->frmlen.did = DIDmsg_lnxind_wlansniffrm_frmlen; | ||
4409 | msg->frmlen.status = 0; | ||
4410 | msg->frmlen.len = 4; | ||
4411 | msg->frmlen.data = hdrlen + datalen + WLAN_CRC_LEN; | ||
4412 | } else if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) && | ||
4413 | (hw->sniffhdr != 0)) { | ||
4414 | p80211_caphdr_t *caphdr; | ||
4415 | /* The NEW header format! */ | ||
4416 | datap = skb_put(skb, sizeof(p80211_caphdr_t)); | ||
4417 | caphdr = (p80211_caphdr_t*) datap; | ||
4418 | |||
4419 | caphdr->version = htonl(P80211CAPTURE_VERSION); | ||
4420 | caphdr->length = htonl(sizeof(p80211_caphdr_t)); | ||
4421 | caphdr->mactime = __cpu_to_be64(rxdesc->time) * 1000; | ||
4422 | caphdr->hosttime = __cpu_to_be64(jiffies); | ||
4423 | caphdr->phytype = htonl(4); /* dss_dot11_b */ | ||
4424 | caphdr->channel = htonl(hw->sniff_channel); | ||
4425 | caphdr->datarate = htonl(rxdesc->rate); | ||
4426 | caphdr->antenna = htonl(0); /* unknown */ | ||
4427 | caphdr->priority = htonl(0); /* unknown */ | ||
4428 | caphdr->ssi_type = htonl(3); /* rssi_raw */ | ||
4429 | caphdr->ssi_signal = htonl(rxdesc->signal); | ||
4430 | caphdr->ssi_noise = htonl(rxdesc->silence); | ||
4431 | caphdr->preamble = htonl(0); /* unknown */ | ||
4432 | caphdr->encoding = htonl(1); /* cck */ | ||
4433 | } | ||
4434 | |||
4435 | /* Copy the 802.11 header to the skb (ctl frames may be less than a full header) */ | ||
4436 | datap = skb_put(skb, hdrlen); | ||
4437 | memcpy( datap, &(rxdesc->frame_control), hdrlen); | ||
4438 | |||
4439 | /* If any, copy the data from the card to the skb */ | ||
4440 | if ( datalen > 0 ) | ||
4441 | { | ||
4442 | datap = skb_put(skb, datalen); | ||
4443 | memcpy(datap, rxfrm->data, datalen); | ||
4444 | |||
4445 | /* check for unencrypted stuff if WEP bit set. */ | ||
4446 | if (*(datap - hdrlen + 1) & 0x40) // wep set | ||
4447 | if ((*(datap) == 0xaa) && (*(datap+1) == 0xaa)) | ||
4448 | *(datap - hdrlen + 1) &= 0xbf; // clear wep; it's the 802.2 header! | ||
4449 | } | ||
4450 | |||
4451 | if (hw->sniff_fcs) { | ||
4452 | /* Set the FCS */ | ||
4453 | datap = skb_put(skb, WLAN_CRC_LEN); | ||
4454 | memset( datap, 0xff, WLAN_CRC_LEN); | ||
4455 | } | ||
4456 | |||
4457 | /* pass it back up */ | ||
4458 | prism2sta_ev_rx(wlandev, skb); | ||
4459 | |||
4460 | DBFEXIT; | ||
4461 | return; | ||
4462 | } | ||
4463 | |||
4464 | |||
4465 | |||
4466 | /*---------------------------------------------------------------- | ||
4467 | * hfa384x_usbin_info | ||
4468 | * | ||
4469 | * At this point we have a successful received a Prism2 info frame. | ||
4470 | * | ||
4471 | * Arguments: | ||
4472 | * wlandev wlan device | ||
4473 | * usbin ptr to the usb transfer buffer | ||
4474 | * | ||
4475 | * Returns: | ||
4476 | * nothing | ||
4477 | * | ||
4478 | * Side effects: | ||
4479 | * | ||
4480 | * Call context: | ||
4481 | * interrupt | ||
4482 | ----------------------------------------------------------------*/ | ||
4483 | static void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin) | ||
4484 | { | ||
4485 | DBFENTER; | ||
4486 | |||
4487 | usbin->infofrm.info.framelen = hfa384x2host_16(usbin->infofrm.info.framelen); | ||
4488 | prism2sta_ev_info(wlandev, &usbin->infofrm.info); | ||
4489 | |||
4490 | DBFEXIT; | ||
4491 | } | ||
4492 | |||
4493 | |||
4494 | |||
4495 | /*---------------------------------------------------------------- | ||
4496 | * hfa384x_usbout_callback | ||
4497 | * | ||
4498 | * Callback for URBs on the BULKOUT endpoint. | ||
4499 | * | ||
4500 | * Arguments: | ||
4501 | * urb ptr to the completed urb | ||
4502 | * | ||
4503 | * Returns: | ||
4504 | * nothing | ||
4505 | * | ||
4506 | * Side effects: | ||
4507 | * | ||
4508 | * Call context: | ||
4509 | * interrupt | ||
4510 | ----------------------------------------------------------------*/ | ||
4511 | #ifdef URB_ONLY_CALLBACK | ||
4512 | static void hfa384x_usbout_callback(struct urb *urb) | ||
4513 | #else | ||
4514 | static void hfa384x_usbout_callback(struct urb *urb, struct pt_regs *regs) | ||
4515 | #endif | ||
4516 | { | ||
4517 | wlandevice_t *wlandev = urb->context; | ||
4518 | hfa384x_usbout_t *usbout = urb->transfer_buffer; | ||
4519 | DBFENTER; | ||
4520 | |||
4521 | #ifdef DEBUG_USB | ||
4522 | dbprint_urb(urb); | ||
4523 | #endif | ||
4524 | |||
4525 | if ( wlandev && | ||
4526 | wlandev->netdev ) { | ||
4527 | |||
4528 | switch(urb->status) { | ||
4529 | case 0: | ||
4530 | hfa384x_usbout_tx(wlandev, usbout); | ||
4531 | break; | ||
4532 | |||
4533 | case -EPIPE: | ||
4534 | { | ||
4535 | hfa384x_t *hw = wlandev->priv; | ||
4536 | WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n", | ||
4537 | wlandev->netdev->name); | ||
4538 | if ( !test_and_set_bit(WORK_TX_HALT, &hw->usb_flags) ) | ||
4539 | schedule_work(&hw->usb_work); | ||
4540 | ++(wlandev->linux_stats.tx_errors); | ||
4541 | break; | ||
4542 | } | ||
4543 | |||
4544 | case -EPROTO: | ||
4545 | case -ETIMEDOUT: | ||
4546 | case -EILSEQ: | ||
4547 | { | ||
4548 | hfa384x_t *hw = wlandev->priv; | ||
4549 | |||
4550 | if ( !test_and_set_bit(THROTTLE_TX, &hw->usb_flags) | ||
4551 | && !timer_pending(&hw->throttle) ) { | ||
4552 | mod_timer(&hw->throttle, | ||
4553 | jiffies + THROTTLE_JIFFIES); | ||
4554 | } | ||
4555 | ++(wlandev->linux_stats.tx_errors); | ||
4556 | netif_stop_queue(wlandev->netdev); | ||
4557 | break; | ||
4558 | } | ||
4559 | |||
4560 | case -ENOENT: | ||
4561 | case -ESHUTDOWN: | ||
4562 | /* Ignorable errors */ | ||
4563 | break; | ||
4564 | |||
4565 | default: | ||
4566 | WLAN_LOG_INFO("unknown urb->status=%d\n", urb->status); | ||
4567 | ++(wlandev->linux_stats.tx_errors); | ||
4568 | break; | ||
4569 | } /* switch */ | ||
4570 | } | ||
4571 | |||
4572 | DBFEXIT; | ||
4573 | } | ||
4574 | |||
4575 | |||
4576 | /*---------------------------------------------------------------- | ||
4577 | * hfa384x_ctlxout_callback | ||
4578 | * | ||
4579 | * Callback for control data on the BULKOUT endpoint. | ||
4580 | * | ||
4581 | * Arguments: | ||
4582 | * urb ptr to the completed urb | ||
4583 | * | ||
4584 | * Returns: | ||
4585 | * nothing | ||
4586 | * | ||
4587 | * Side effects: | ||
4588 | * | ||
4589 | * Call context: | ||
4590 | * interrupt | ||
4591 | ----------------------------------------------------------------*/ | ||
4592 | #ifdef URB_ONLY_CALLBACK | ||
4593 | static void hfa384x_ctlxout_callback(struct urb *urb) | ||
4594 | #else | ||
4595 | static void hfa384x_ctlxout_callback(struct urb *urb, struct pt_regs *regs) | ||
4596 | #endif | ||
4597 | { | ||
4598 | hfa384x_t *hw = urb->context; | ||
4599 | int delete_resptimer = 0; | ||
4600 | int timer_ok = 1; | ||
4601 | int run_queue = 0; | ||
4602 | hfa384x_usbctlx_t *ctlx; | ||
4603 | unsigned long flags; | ||
4604 | |||
4605 | DBFENTER; | ||
4606 | |||
4607 | WLAN_LOG_DEBUG(3,"urb->status=%d\n", urb->status); | ||
4608 | #ifdef DEBUG_USB | ||
4609 | dbprint_urb(urb); | ||
4610 | #endif | ||
4611 | if ( (urb->status == -ESHUTDOWN) || | ||
4612 | (urb->status == -ENODEV) || | ||
4613 | (hw == NULL) ) | ||
4614 | goto done; | ||
4615 | |||
4616 | retry: | ||
4617 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
4618 | |||
4619 | /* | ||
4620 | * Only one CTLX at a time on the "active" list, and | ||
4621 | * none at all if we are unplugged. However, we can | ||
4622 | * rely on the disconnect function to clean everything | ||
4623 | * up if someone unplugged the adapter. | ||
4624 | */ | ||
4625 | if ( list_empty(&hw->ctlxq.active) ) { | ||
4626 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4627 | goto done; | ||
4628 | } | ||
4629 | |||
4630 | /* | ||
4631 | * Having something on the "active" queue means | ||
4632 | * that we have timers to worry about ... | ||
4633 | */ | ||
4634 | if (del_timer(&hw->reqtimer) == 0) { | ||
4635 | if (hw->req_timer_done == 0) { | ||
4636 | /* | ||
4637 | * This timer was actually running while we | ||
4638 | * were trying to delete it. Let it terminate | ||
4639 | * gracefully instead. | ||
4640 | */ | ||
4641 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4642 | goto retry; | ||
4643 | } | ||
4644 | } | ||
4645 | else { | ||
4646 | hw->req_timer_done = 1; | ||
4647 | } | ||
4648 | |||
4649 | ctlx = get_active_ctlx(hw); | ||
4650 | |||
4651 | if ( urb->status == 0 ) { | ||
4652 | /* Request portion of a CTLX is successful */ | ||
4653 | switch ( ctlx->state ) { | ||
4654 | case CTLX_REQ_SUBMITTED: | ||
4655 | /* This OUT-ACK received before IN */ | ||
4656 | ctlx->state = CTLX_REQ_COMPLETE; | ||
4657 | break; | ||
4658 | |||
4659 | case CTLX_RESP_COMPLETE: | ||
4660 | /* IN already received before this OUT-ACK, | ||
4661 | * so this command must now be complete. | ||
4662 | */ | ||
4663 | ctlx->state = CTLX_COMPLETE; | ||
4664 | unlocked_usbctlx_complete(hw, ctlx); | ||
4665 | run_queue = 1; | ||
4666 | break; | ||
4667 | |||
4668 | default: | ||
4669 | /* This is NOT a valid CTLX "success" state! */ | ||
4670 | WLAN_LOG_ERROR( | ||
4671 | "Illegal CTLX[%d] success state(%s, %d) in OUT URB\n", | ||
4672 | hfa384x2host_16(ctlx->outbuf.type), | ||
4673 | ctlxstr(ctlx->state), urb->status); | ||
4674 | break; | ||
4675 | } /* switch */ | ||
4676 | } else { | ||
4677 | /* If the pipe has stalled then we need to reset it */ | ||
4678 | if ( (urb->status == -EPIPE) && | ||
4679 | !test_and_set_bit(WORK_TX_HALT, &hw->usb_flags) ) { | ||
4680 | WLAN_LOG_WARNING("%s tx pipe stalled: requesting reset\n", | ||
4681 | hw->wlandev->netdev->name); | ||
4682 | schedule_work(&hw->usb_work); | ||
4683 | } | ||
4684 | |||
4685 | /* If someone cancels the OUT URB then its status | ||
4686 | * should be either -ECONNRESET or -ENOENT. | ||
4687 | */ | ||
4688 | ctlx->state = CTLX_REQ_FAILED; | ||
4689 | unlocked_usbctlx_complete(hw, ctlx); | ||
4690 | delete_resptimer = 1; | ||
4691 | run_queue = 1; | ||
4692 | } | ||
4693 | |||
4694 | delresp: | ||
4695 | if (delete_resptimer) { | ||
4696 | if ((timer_ok = del_timer(&hw->resptimer)) != 0) { | ||
4697 | hw->resp_timer_done = 1; | ||
4698 | } | ||
4699 | } | ||
4700 | |||
4701 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4702 | |||
4703 | if ( !timer_ok && (hw->resp_timer_done == 0) ) { | ||
4704 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
4705 | goto delresp; | ||
4706 | } | ||
4707 | |||
4708 | if (run_queue) | ||
4709 | hfa384x_usbctlxq_run(hw); | ||
4710 | |||
4711 | done: | ||
4712 | DBFEXIT; | ||
4713 | } | ||
4714 | |||
4715 | |||
4716 | /*---------------------------------------------------------------- | ||
4717 | * hfa384x_usbctlx_reqtimerfn | ||
4718 | * | ||
4719 | * Timer response function for CTLX request timeouts. If this | ||
4720 | * function is called, it means that the callback for the OUT | ||
4721 | * URB containing a Prism2.x XXX_Request was never called. | ||
4722 | * | ||
4723 | * Arguments: | ||
4724 | * data a ptr to the hfa384x_t | ||
4725 | * | ||
4726 | * Returns: | ||
4727 | * nothing | ||
4728 | * | ||
4729 | * Side effects: | ||
4730 | * | ||
4731 | * Call context: | ||
4732 | * interrupt | ||
4733 | ----------------------------------------------------------------*/ | ||
4734 | static void | ||
4735 | hfa384x_usbctlx_reqtimerfn(unsigned long data) | ||
4736 | { | ||
4737 | hfa384x_t *hw = (hfa384x_t*)data; | ||
4738 | unsigned long flags; | ||
4739 | DBFENTER; | ||
4740 | |||
4741 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
4742 | |||
4743 | hw->req_timer_done = 1; | ||
4744 | |||
4745 | /* Removing the hardware automatically empties | ||
4746 | * the active list ... | ||
4747 | */ | ||
4748 | if ( !list_empty(&hw->ctlxq.active) ) | ||
4749 | { | ||
4750 | /* | ||
4751 | * We must ensure that our URB is removed from | ||
4752 | * the system, if it hasn't already expired. | ||
4753 | */ | ||
4754 | hw->ctlx_urb.transfer_flags |= URB_ASYNC_UNLINK; | ||
4755 | if (usb_unlink_urb(&hw->ctlx_urb) == -EINPROGRESS) | ||
4756 | { | ||
4757 | hfa384x_usbctlx_t *ctlx = get_active_ctlx(hw); | ||
4758 | |||
4759 | ctlx->state = CTLX_REQ_FAILED; | ||
4760 | |||
4761 | /* This URB was active, but has now been | ||
4762 | * cancelled. It will now have a status of | ||
4763 | * -ECONNRESET in the callback function. | ||
4764 | * | ||
4765 | * We are cancelling this CTLX, so we're | ||
4766 | * not going to need to wait for a response. | ||
4767 | * The URB's callback function will check | ||
4768 | * that this timer is truly dead. | ||
4769 | */ | ||
4770 | if (del_timer(&hw->resptimer) != 0) | ||
4771 | hw->resp_timer_done = 1; | ||
4772 | } | ||
4773 | } | ||
4774 | |||
4775 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4776 | |||
4777 | DBFEXIT; | ||
4778 | } | ||
4779 | |||
4780 | |||
4781 | /*---------------------------------------------------------------- | ||
4782 | * hfa384x_usbctlx_resptimerfn | ||
4783 | * | ||
4784 | * Timer response function for CTLX response timeouts. If this | ||
4785 | * function is called, it means that the callback for the IN | ||
4786 | * URB containing a Prism2.x XXX_Response was never called. | ||
4787 | * | ||
4788 | * Arguments: | ||
4789 | * data a ptr to the hfa384x_t | ||
4790 | * | ||
4791 | * Returns: | ||
4792 | * nothing | ||
4793 | * | ||
4794 | * Side effects: | ||
4795 | * | ||
4796 | * Call context: | ||
4797 | * interrupt | ||
4798 | ----------------------------------------------------------------*/ | ||
4799 | static void | ||
4800 | hfa384x_usbctlx_resptimerfn(unsigned long data) | ||
4801 | { | ||
4802 | hfa384x_t *hw = (hfa384x_t*)data; | ||
4803 | unsigned long flags; | ||
4804 | |||
4805 | DBFENTER; | ||
4806 | |||
4807 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
4808 | |||
4809 | hw->resp_timer_done = 1; | ||
4810 | |||
4811 | /* The active list will be empty if the | ||
4812 | * adapter has been unplugged ... | ||
4813 | */ | ||
4814 | if ( !list_empty(&hw->ctlxq.active) ) | ||
4815 | { | ||
4816 | hfa384x_usbctlx_t *ctlx = get_active_ctlx(hw); | ||
4817 | |||
4818 | if ( unlocked_usbctlx_cancel_async(hw, ctlx) == 0 ) | ||
4819 | { | ||
4820 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4821 | hfa384x_usbctlxq_run(hw); | ||
4822 | goto done; | ||
4823 | } | ||
4824 | } | ||
4825 | |||
4826 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4827 | |||
4828 | done: | ||
4829 | DBFEXIT; | ||
4830 | } | ||
4831 | |||
4832 | /*---------------------------------------------------------------- | ||
4833 | * hfa384x_usb_throttlefn | ||
4834 | * | ||
4835 | * | ||
4836 | * Arguments: | ||
4837 | * data ptr to hw | ||
4838 | * | ||
4839 | * Returns: | ||
4840 | * Nothing | ||
4841 | * | ||
4842 | * Side effects: | ||
4843 | * | ||
4844 | * Call context: | ||
4845 | * Interrupt | ||
4846 | ----------------------------------------------------------------*/ | ||
4847 | static void | ||
4848 | hfa384x_usb_throttlefn(unsigned long data) | ||
4849 | { | ||
4850 | hfa384x_t *hw = (hfa384x_t*)data; | ||
4851 | unsigned long flags; | ||
4852 | |||
4853 | DBFENTER; | ||
4854 | |||
4855 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
4856 | |||
4857 | /* | ||
4858 | * We need to check BOTH the RX and the TX throttle controls, | ||
4859 | * so we use the bitwise OR instead of the logical OR. | ||
4860 | */ | ||
4861 | WLAN_LOG_DEBUG(3, "flags=0x%lx\n", hw->usb_flags); | ||
4862 | if ( !hw->wlandev->hwremoved && | ||
4863 | ( | ||
4864 | (test_and_clear_bit(THROTTLE_RX, &hw->usb_flags) && | ||
4865 | !test_and_set_bit(WORK_RX_RESUME, &hw->usb_flags)) | ||
4866 | | | ||
4867 | (test_and_clear_bit(THROTTLE_TX, &hw->usb_flags) && | ||
4868 | !test_and_set_bit(WORK_TX_RESUME, &hw->usb_flags)) | ||
4869 | ) ) | ||
4870 | { | ||
4871 | schedule_work(&hw->usb_work); | ||
4872 | } | ||
4873 | |||
4874 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4875 | |||
4876 | DBFEXIT; | ||
4877 | } | ||
4878 | |||
4879 | |||
4880 | /*---------------------------------------------------------------- | ||
4881 | * hfa384x_usbctlx_submit | ||
4882 | * | ||
4883 | * Called from the doxxx functions to submit a CTLX to the queue | ||
4884 | * | ||
4885 | * Arguments: | ||
4886 | * hw ptr to the hw struct | ||
4887 | * ctlx ctlx structure to enqueue | ||
4888 | * | ||
4889 | * Returns: | ||
4890 | * -ENODEV if the adapter is unplugged | ||
4891 | * 0 | ||
4892 | * | ||
4893 | * Side effects: | ||
4894 | * | ||
4895 | * Call context: | ||
4896 | * process or interrupt | ||
4897 | ----------------------------------------------------------------*/ | ||
4898 | static int | ||
4899 | hfa384x_usbctlx_submit( | ||
4900 | hfa384x_t *hw, | ||
4901 | hfa384x_usbctlx_t *ctlx) | ||
4902 | { | ||
4903 | unsigned long flags; | ||
4904 | int ret; | ||
4905 | |||
4906 | DBFENTER; | ||
4907 | |||
4908 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
4909 | |||
4910 | if (hw->wlandev->hwremoved) { | ||
4911 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4912 | ret = -ENODEV; | ||
4913 | } else { | ||
4914 | ctlx->state = CTLX_PENDING; | ||
4915 | list_add_tail(&ctlx->list, &hw->ctlxq.pending); | ||
4916 | |||
4917 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
4918 | hfa384x_usbctlxq_run(hw); | ||
4919 | ret = 0; | ||
4920 | } | ||
4921 | |||
4922 | DBFEXIT; | ||
4923 | return ret; | ||
4924 | } | ||
4925 | |||
4926 | |||
4927 | /*---------------------------------------------------------------- | ||
4928 | * hfa384x_usbout_tx | ||
4929 | * | ||
4930 | * At this point we have finished a send of a frame. Mark the URB | ||
4931 | * as available and call ev_alloc to notify higher layers we're | ||
4932 | * ready for more. | ||
4933 | * | ||
4934 | * Arguments: | ||
4935 | * wlandev wlan device | ||
4936 | * usbout ptr to the usb transfer buffer | ||
4937 | * | ||
4938 | * Returns: | ||
4939 | * nothing | ||
4940 | * | ||
4941 | * Side effects: | ||
4942 | * | ||
4943 | * Call context: | ||
4944 | * interrupt | ||
4945 | ----------------------------------------------------------------*/ | ||
4946 | static void hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout) | ||
4947 | { | ||
4948 | DBFENTER; | ||
4949 | |||
4950 | prism2sta_ev_alloc(wlandev); | ||
4951 | |||
4952 | DBFEXIT; | ||
4953 | } | ||
4954 | |||
4955 | /*---------------------------------------------------------------- | ||
4956 | * hfa384x_isgood_pdrcore | ||
4957 | * | ||
4958 | * Quick check of PDR codes. | ||
4959 | * | ||
4960 | * Arguments: | ||
4961 | * pdrcode PDR code number (host order) | ||
4962 | * | ||
4963 | * Returns: | ||
4964 | * zero not good. | ||
4965 | * one is good. | ||
4966 | * | ||
4967 | * Side effects: | ||
4968 | * | ||
4969 | * Call context: | ||
4970 | ----------------------------------------------------------------*/ | ||
4971 | static int | ||
4972 | hfa384x_isgood_pdrcode(UINT16 pdrcode) | ||
4973 | { | ||
4974 | switch(pdrcode) { | ||
4975 | case HFA384x_PDR_END_OF_PDA: | ||
4976 | case HFA384x_PDR_PCB_PARTNUM: | ||
4977 | case HFA384x_PDR_PDAVER: | ||
4978 | case HFA384x_PDR_NIC_SERIAL: | ||
4979 | case HFA384x_PDR_MKK_MEASUREMENTS: | ||
4980 | case HFA384x_PDR_NIC_RAMSIZE: | ||
4981 | case HFA384x_PDR_MFISUPRANGE: | ||
4982 | case HFA384x_PDR_CFISUPRANGE: | ||
4983 | case HFA384x_PDR_NICID: | ||
4984 | case HFA384x_PDR_MAC_ADDRESS: | ||
4985 | case HFA384x_PDR_REGDOMAIN: | ||
4986 | case HFA384x_PDR_ALLOWED_CHANNEL: | ||
4987 | case HFA384x_PDR_DEFAULT_CHANNEL: | ||
4988 | case HFA384x_PDR_TEMPTYPE: | ||
4989 | case HFA384x_PDR_IFR_SETTING: | ||
4990 | case HFA384x_PDR_RFR_SETTING: | ||
4991 | case HFA384x_PDR_HFA3861_BASELINE: | ||
4992 | case HFA384x_PDR_HFA3861_SHADOW: | ||
4993 | case HFA384x_PDR_HFA3861_IFRF: | ||
4994 | case HFA384x_PDR_HFA3861_CHCALSP: | ||
4995 | case HFA384x_PDR_HFA3861_CHCALI: | ||
4996 | case HFA384x_PDR_3842_NIC_CONFIG: | ||
4997 | case HFA384x_PDR_USB_ID: | ||
4998 | case HFA384x_PDR_PCI_ID: | ||
4999 | case HFA384x_PDR_PCI_IFCONF: | ||
5000 | case HFA384x_PDR_PCI_PMCONF: | ||
5001 | case HFA384x_PDR_RFENRGY: | ||
5002 | case HFA384x_PDR_HFA3861_MANF_TESTSP: | ||
5003 | case HFA384x_PDR_HFA3861_MANF_TESTI: | ||
5004 | /* code is OK */ | ||
5005 | return 1; | ||
5006 | break; | ||
5007 | default: | ||
5008 | if ( pdrcode < 0x1000 ) { | ||
5009 | /* code is OK, but we don't know exactly what it is */ | ||
5010 | WLAN_LOG_DEBUG(3, | ||
5011 | "Encountered unknown PDR#=0x%04x, " | ||
5012 | "assuming it's ok.\n", | ||
5013 | pdrcode); | ||
5014 | return 1; | ||
5015 | } else { | ||
5016 | /* bad code */ | ||
5017 | WLAN_LOG_DEBUG(3, | ||
5018 | "Encountered unknown PDR#=0x%04x, " | ||
5019 | "(>=0x1000), assuming it's bad.\n", | ||
5020 | pdrcode); | ||
5021 | return 0; | ||
5022 | } | ||
5023 | break; | ||
5024 | } | ||
5025 | return 0; /* avoid compiler warnings */ | ||
5026 | } | ||
5027 | |||
diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c new file mode 100644 index 000000000000..68121b9b34fa --- /dev/null +++ b/drivers/staging/wlan-ng/p80211conv.c | |||
@@ -0,0 +1,683 @@ | |||
1 | /* src/p80211/p80211conv.c | ||
2 | * | ||
3 | * Ether/802.11 conversions and packet buffer routines | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file defines the functions that perform Ethernet to/from | ||
48 | * 802.11 frame conversions. | ||
49 | * | ||
50 | * -------------------------------------------------------------------- | ||
51 | */ | ||
52 | /*================================================================*/ | ||
53 | /* System Includes */ | ||
54 | |||
55 | #define __NO_VERSION__ /* prevent the static definition */ | ||
56 | |||
57 | |||
58 | #include <linux/version.h> | ||
59 | |||
60 | #include <linux/module.h> | ||
61 | #include <linux/kernel.h> | ||
62 | #include <linux/sched.h> | ||
63 | #include <linux/types.h> | ||
64 | #include <linux/skbuff.h> | ||
65 | #include <linux/slab.h> | ||
66 | #include <linux/wireless.h> | ||
67 | #include <linux/netdevice.h> | ||
68 | #include <linux/etherdevice.h> | ||
69 | #include <linux/if_ether.h> | ||
70 | |||
71 | #include <asm/byteorder.h> | ||
72 | |||
73 | #include "version.h" | ||
74 | #include "wlan_compat.h" | ||
75 | |||
76 | /*================================================================*/ | ||
77 | /* Project Includes */ | ||
78 | |||
79 | #include "p80211types.h" | ||
80 | #include "p80211hdr.h" | ||
81 | #include "p80211conv.h" | ||
82 | #include "p80211mgmt.h" | ||
83 | #include "p80211msg.h" | ||
84 | #include "p80211netdev.h" | ||
85 | #include "p80211ioctl.h" | ||
86 | #include "p80211req.h" | ||
87 | |||
88 | |||
89 | /*================================================================*/ | ||
90 | /* Local Constants */ | ||
91 | |||
92 | /*================================================================*/ | ||
93 | /* Local Macros */ | ||
94 | |||
95 | |||
96 | /*================================================================*/ | ||
97 | /* Local Types */ | ||
98 | |||
99 | |||
100 | /*================================================================*/ | ||
101 | /* Local Static Definitions */ | ||
102 | |||
103 | static UINT8 oui_rfc1042[] = {0x00, 0x00, 0x00}; | ||
104 | static UINT8 oui_8021h[] = {0x00, 0x00, 0xf8}; | ||
105 | |||
106 | /*================================================================*/ | ||
107 | /* Local Function Declarations */ | ||
108 | |||
109 | |||
110 | /*================================================================*/ | ||
111 | /* Function Definitions */ | ||
112 | |||
113 | /*---------------------------------------------------------------- | ||
114 | * p80211pb_ether_to_80211 | ||
115 | * | ||
116 | * Uses the contents of the ether frame and the etherconv setting | ||
117 | * to build the elements of the 802.11 frame. | ||
118 | * | ||
119 | * We don't actually set | ||
120 | * up the frame header here. That's the MAC's job. We're only handling | ||
121 | * conversion of DIXII or 802.3+LLC frames to something that works | ||
122 | * with 802.11. | ||
123 | * | ||
124 | * Note -- 802.11 header is NOT part of the skb. Likewise, the 802.11 | ||
125 | * FCS is also not present and will need to be added elsewhere. | ||
126 | * | ||
127 | * Arguments: | ||
128 | * ethconv Conversion type to perform | ||
129 | * skb skbuff containing the ether frame | ||
130 | * p80211_hdr 802.11 header | ||
131 | * | ||
132 | * Returns: | ||
133 | * 0 on success, non-zero otherwise | ||
134 | * | ||
135 | * Call context: | ||
136 | * May be called in interrupt or non-interrupt context | ||
137 | ----------------------------------------------------------------*/ | ||
138 | int skb_ether_to_p80211( wlandevice_t *wlandev, UINT32 ethconv, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep) | ||
139 | { | ||
140 | |||
141 | UINT16 fc; | ||
142 | UINT16 proto; | ||
143 | wlan_ethhdr_t e_hdr; | ||
144 | wlan_llc_t *e_llc; | ||
145 | wlan_snap_t *e_snap; | ||
146 | int foo; | ||
147 | |||
148 | DBFENTER; | ||
149 | memcpy(&e_hdr, skb->data, sizeof(e_hdr)); | ||
150 | |||
151 | if (skb->len <= 0) { | ||
152 | WLAN_LOG_DEBUG(1, "zero-length skb!\n"); | ||
153 | return 1; | ||
154 | } | ||
155 | |||
156 | if ( ethconv == WLAN_ETHCONV_ENCAP ) { /* simplest case */ | ||
157 | WLAN_LOG_DEBUG(3, "ENCAP len: %d\n", skb->len); | ||
158 | /* here, we don't care what kind of ether frm. Just stick it */ | ||
159 | /* in the 80211 payload */ | ||
160 | /* which is to say, leave the skb alone. */ | ||
161 | } else { | ||
162 | /* step 1: classify ether frame, DIX or 802.3? */ | ||
163 | proto = ntohs(e_hdr.type); | ||
164 | if ( proto <= 1500 ) { | ||
165 | WLAN_LOG_DEBUG(3, "802.3 len: %d\n", skb->len); | ||
166 | /* codes <= 1500 reserved for 802.3 lengths */ | ||
167 | /* it's 802.3, pass ether payload unchanged, */ | ||
168 | |||
169 | /* trim off ethernet header */ | ||
170 | skb_pull(skb, WLAN_ETHHDR_LEN); | ||
171 | |||
172 | /* leave off any PAD octets. */ | ||
173 | skb_trim(skb, proto); | ||
174 | } else { | ||
175 | WLAN_LOG_DEBUG(3, "DIXII len: %d\n", skb->len); | ||
176 | /* it's DIXII, time for some conversion */ | ||
177 | |||
178 | /* trim off ethernet header */ | ||
179 | skb_pull(skb, WLAN_ETHHDR_LEN); | ||
180 | |||
181 | /* tack on SNAP */ | ||
182 | e_snap = (wlan_snap_t *) skb_push(skb, sizeof(wlan_snap_t)); | ||
183 | e_snap->type = htons(proto); | ||
184 | if ( ethconv == WLAN_ETHCONV_8021h && p80211_stt_findproto(proto) ) { | ||
185 | memcpy( e_snap->oui, oui_8021h, WLAN_IEEE_OUI_LEN); | ||
186 | } else { | ||
187 | memcpy( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN); | ||
188 | } | ||
189 | |||
190 | /* tack on llc */ | ||
191 | e_llc = (wlan_llc_t *) skb_push(skb, sizeof(wlan_llc_t)); | ||
192 | e_llc->dsap = 0xAA; /* SNAP, see IEEE 802 */ | ||
193 | e_llc->ssap = 0xAA; | ||
194 | e_llc->ctl = 0x03; | ||
195 | |||
196 | } | ||
197 | } | ||
198 | |||
199 | /* Set up the 802.11 header */ | ||
200 | /* It's a data frame */ | ||
201 | fc = host2ieee16( WLAN_SET_FC_FTYPE(WLAN_FTYPE_DATA) | | ||
202 | WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_DATAONLY)); | ||
203 | |||
204 | switch ( wlandev->macmode ) { | ||
205 | case WLAN_MACMODE_IBSS_STA: | ||
206 | memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, WLAN_ADDR_LEN); | ||
207 | memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, WLAN_ADDR_LEN); | ||
208 | memcpy(p80211_hdr->a3.a3, wlandev->bssid, WLAN_ADDR_LEN); | ||
209 | break; | ||
210 | case WLAN_MACMODE_ESS_STA: | ||
211 | fc |= host2ieee16(WLAN_SET_FC_TODS(1)); | ||
212 | memcpy(p80211_hdr->a3.a1, wlandev->bssid, WLAN_ADDR_LEN); | ||
213 | memcpy(p80211_hdr->a3.a2, wlandev->netdev->dev_addr, WLAN_ADDR_LEN); | ||
214 | memcpy(p80211_hdr->a3.a3, &e_hdr.daddr, WLAN_ADDR_LEN); | ||
215 | break; | ||
216 | case WLAN_MACMODE_ESS_AP: | ||
217 | fc |= host2ieee16(WLAN_SET_FC_FROMDS(1)); | ||
218 | memcpy(p80211_hdr->a3.a1, &e_hdr.daddr, WLAN_ADDR_LEN); | ||
219 | memcpy(p80211_hdr->a3.a2, wlandev->bssid, WLAN_ADDR_LEN); | ||
220 | memcpy(p80211_hdr->a3.a3, &e_hdr.saddr, WLAN_ADDR_LEN); | ||
221 | break; | ||
222 | default: | ||
223 | WLAN_LOG_ERROR("Error: Converting eth to wlan in unknown mode.\n"); | ||
224 | return 1; | ||
225 | break; | ||
226 | } | ||
227 | |||
228 | p80211_wep->data = NULL; | ||
229 | |||
230 | if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) && (wlandev->hostwep & HOSTWEP_ENCRYPT)) { | ||
231 | // XXXX need to pick keynum other than default? | ||
232 | |||
233 | #if 1 | ||
234 | p80211_wep->data = kmalloc(skb->len, GFP_ATOMIC); | ||
235 | #else | ||
236 | p80211_wep->data = skb->data; | ||
237 | #endif | ||
238 | |||
239 | if ((foo = wep_encrypt(wlandev, skb->data, p80211_wep->data, | ||
240 | skb->len, | ||
241 | (wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK), | ||
242 | p80211_wep->iv, p80211_wep->icv))) { | ||
243 | WLAN_LOG_WARNING("Host en-WEP failed, dropping frame (%d).\n", foo); | ||
244 | return 2; | ||
245 | } | ||
246 | fc |= host2ieee16(WLAN_SET_FC_ISWEP(1)); | ||
247 | } | ||
248 | |||
249 | |||
250 | // skb->nh.raw = skb->data; | ||
251 | |||
252 | p80211_hdr->a3.fc = fc; | ||
253 | p80211_hdr->a3.dur = 0; | ||
254 | p80211_hdr->a3.seq = 0; | ||
255 | |||
256 | DBFEXIT; | ||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | /* jkriegl: from orinoco, modified */ | ||
261 | static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac, | ||
262 | p80211_rxmeta_t *rxmeta) | ||
263 | { | ||
264 | int i; | ||
265 | |||
266 | /* Gather wireless spy statistics: for each packet, compare the | ||
267 | * source address with out list, and if match, get the stats... */ | ||
268 | |||
269 | for (i = 0; i < wlandev->spy_number; i++) { | ||
270 | |||
271 | if (!memcmp(wlandev->spy_address[i], mac, ETH_ALEN)) { | ||
272 | memcpy(wlandev->spy_address[i], mac, ETH_ALEN); | ||
273 | wlandev->spy_stat[i].level = rxmeta->signal; | ||
274 | wlandev->spy_stat[i].noise = rxmeta->noise; | ||
275 | wlandev->spy_stat[i].qual = (rxmeta->signal > rxmeta->noise) ? \ | ||
276 | (rxmeta->signal - rxmeta->noise) : 0; | ||
277 | wlandev->spy_stat[i].updated = 0x7; | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | |||
282 | /*---------------------------------------------------------------- | ||
283 | * p80211pb_80211_to_ether | ||
284 | * | ||
285 | * Uses the contents of a received 802.11 frame and the etherconv | ||
286 | * setting to build an ether frame. | ||
287 | * | ||
288 | * This function extracts the src and dest address from the 802.11 | ||
289 | * frame to use in the construction of the eth frame. | ||
290 | * | ||
291 | * Arguments: | ||
292 | * ethconv Conversion type to perform | ||
293 | * skb Packet buffer containing the 802.11 frame | ||
294 | * | ||
295 | * Returns: | ||
296 | * 0 on success, non-zero otherwise | ||
297 | * | ||
298 | * Call context: | ||
299 | * May be called in interrupt or non-interrupt context | ||
300 | ----------------------------------------------------------------*/ | ||
301 | int skb_p80211_to_ether( wlandevice_t *wlandev, UINT32 ethconv, struct sk_buff *skb) | ||
302 | { | ||
303 | netdevice_t *netdev = wlandev->netdev; | ||
304 | UINT16 fc; | ||
305 | UINT payload_length; | ||
306 | UINT payload_offset; | ||
307 | UINT8 daddr[WLAN_ETHADDR_LEN]; | ||
308 | UINT8 saddr[WLAN_ETHADDR_LEN]; | ||
309 | p80211_hdr_t *w_hdr; | ||
310 | wlan_ethhdr_t *e_hdr; | ||
311 | wlan_llc_t *e_llc; | ||
312 | wlan_snap_t *e_snap; | ||
313 | |||
314 | int foo; | ||
315 | |||
316 | DBFENTER; | ||
317 | |||
318 | payload_length = skb->len - WLAN_HDR_A3_LEN - WLAN_CRC_LEN; | ||
319 | payload_offset = WLAN_HDR_A3_LEN; | ||
320 | |||
321 | w_hdr = (p80211_hdr_t *) skb->data; | ||
322 | |||
323 | /* setup some vars for convenience */ | ||
324 | fc = ieee2host16(w_hdr->a3.fc); | ||
325 | if ( (WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 0) ) { | ||
326 | memcpy(daddr, w_hdr->a3.a1, WLAN_ETHADDR_LEN); | ||
327 | memcpy(saddr, w_hdr->a3.a2, WLAN_ETHADDR_LEN); | ||
328 | } else if( (WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 1) ) { | ||
329 | memcpy(daddr, w_hdr->a3.a1, WLAN_ETHADDR_LEN); | ||
330 | memcpy(saddr, w_hdr->a3.a3, WLAN_ETHADDR_LEN); | ||
331 | } else if( (WLAN_GET_FC_TODS(fc) == 1) && (WLAN_GET_FC_FROMDS(fc) == 0) ) { | ||
332 | memcpy(daddr, w_hdr->a3.a3, WLAN_ETHADDR_LEN); | ||
333 | memcpy(saddr, w_hdr->a3.a2, WLAN_ETHADDR_LEN); | ||
334 | } else { | ||
335 | payload_offset = WLAN_HDR_A4_LEN; | ||
336 | payload_length -= ( WLAN_HDR_A4_LEN - WLAN_HDR_A3_LEN ); | ||
337 | if (payload_length < 0 ) { | ||
338 | WLAN_LOG_ERROR("A4 frame too short!\n"); | ||
339 | return 1; | ||
340 | } | ||
341 | memcpy(daddr, w_hdr->a4.a3, WLAN_ETHADDR_LEN); | ||
342 | memcpy(saddr, w_hdr->a4.a4, WLAN_ETHADDR_LEN); | ||
343 | } | ||
344 | |||
345 | /* perform de-wep if necessary.. */ | ||
346 | if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) && WLAN_GET_FC_ISWEP(fc) && (wlandev->hostwep & HOSTWEP_DECRYPT)) { | ||
347 | if (payload_length <= 8) { | ||
348 | WLAN_LOG_ERROR("WEP frame too short (%u).\n", | ||
349 | skb->len); | ||
350 | return 1; | ||
351 | } | ||
352 | if ((foo = wep_decrypt(wlandev, skb->data + payload_offset + 4, | ||
353 | payload_length - 8, -1, | ||
354 | skb->data + payload_offset, | ||
355 | skb->data + payload_offset + payload_length - 4))) { | ||
356 | /* de-wep failed, drop skb. */ | ||
357 | WLAN_LOG_DEBUG(1, "Host de-WEP failed, dropping frame (%d).\n", foo); | ||
358 | wlandev->rx.decrypt_err++; | ||
359 | return 2; | ||
360 | } | ||
361 | |||
362 | /* subtract the IV+ICV length off the payload */ | ||
363 | payload_length -= 8; | ||
364 | /* chop off the IV */ | ||
365 | skb_pull(skb, 4); | ||
366 | /* chop off the ICV. */ | ||
367 | skb_trim(skb, skb->len - 4); | ||
368 | |||
369 | wlandev->rx.decrypt++; | ||
370 | } | ||
371 | |||
372 | e_hdr = (wlan_ethhdr_t *) (skb->data + payload_offset); | ||
373 | |||
374 | e_llc = (wlan_llc_t *) (skb->data + payload_offset); | ||
375 | e_snap = (wlan_snap_t *) (skb->data + payload_offset + sizeof(wlan_llc_t)); | ||
376 | |||
377 | /* Test for the various encodings */ | ||
378 | if ( (payload_length >= sizeof(wlan_ethhdr_t)) && | ||
379 | ( e_llc->dsap != 0xaa || e_llc->ssap != 0xaa ) && | ||
380 | ((memcmp(daddr, e_hdr->daddr, WLAN_ETHADDR_LEN) == 0) || | ||
381 | (memcmp(saddr, e_hdr->saddr, WLAN_ETHADDR_LEN) == 0))) { | ||
382 | WLAN_LOG_DEBUG(3, "802.3 ENCAP len: %d\n", payload_length); | ||
383 | /* 802.3 Encapsulated */ | ||
384 | /* Test for an overlength frame */ | ||
385 | if ( payload_length > (netdev->mtu + WLAN_ETHHDR_LEN)) { | ||
386 | /* A bogus length ethfrm has been encap'd. */ | ||
387 | /* Is someone trying an oflow attack? */ | ||
388 | WLAN_LOG_ERROR("ENCAP frame too large (%d > %d)\n", | ||
389 | payload_length, netdev->mtu + WLAN_ETHHDR_LEN); | ||
390 | return 1; | ||
391 | } | ||
392 | |||
393 | /* Chop off the 802.11 header. it's already sane. */ | ||
394 | skb_pull(skb, payload_offset); | ||
395 | /* chop off the 802.11 CRC */ | ||
396 | skb_trim(skb, skb->len - WLAN_CRC_LEN); | ||
397 | |||
398 | } else if ((payload_length >= sizeof(wlan_llc_t) + sizeof(wlan_snap_t)) && | ||
399 | (e_llc->dsap == 0xaa) && | ||
400 | (e_llc->ssap == 0xaa) && | ||
401 | (e_llc->ctl == 0x03) && | ||
402 | (((memcmp( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)==0) && | ||
403 | (ethconv == WLAN_ETHCONV_8021h) && | ||
404 | (p80211_stt_findproto(ieee2host16(e_snap->type)))) || | ||
405 | (memcmp( e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN)!=0))) | ||
406 | { | ||
407 | WLAN_LOG_DEBUG(3, "SNAP+RFC1042 len: %d\n", payload_length); | ||
408 | /* it's a SNAP + RFC1042 frame && protocol is in STT */ | ||
409 | /* build 802.3 + RFC1042 */ | ||
410 | |||
411 | /* Test for an overlength frame */ | ||
412 | if ( payload_length > netdev->mtu ) { | ||
413 | /* A bogus length ethfrm has been sent. */ | ||
414 | /* Is someone trying an oflow attack? */ | ||
415 | WLAN_LOG_ERROR("SNAP frame too large (%d > %d)\n", | ||
416 | payload_length, netdev->mtu); | ||
417 | return 1; | ||
418 | } | ||
419 | |||
420 | /* chop 802.11 header from skb. */ | ||
421 | skb_pull(skb, payload_offset); | ||
422 | |||
423 | /* create 802.3 header at beginning of skb. */ | ||
424 | e_hdr = (wlan_ethhdr_t *) skb_push(skb, WLAN_ETHHDR_LEN); | ||
425 | memcpy(e_hdr->daddr, daddr, WLAN_ETHADDR_LEN); | ||
426 | memcpy(e_hdr->saddr, saddr, WLAN_ETHADDR_LEN); | ||
427 | e_hdr->type = htons(payload_length); | ||
428 | |||
429 | /* chop off the 802.11 CRC */ | ||
430 | skb_trim(skb, skb->len - WLAN_CRC_LEN); | ||
431 | |||
432 | } else if ((payload_length >= sizeof(wlan_llc_t) + sizeof(wlan_snap_t)) && | ||
433 | (e_llc->dsap == 0xaa) && | ||
434 | (e_llc->ssap == 0xaa) && | ||
435 | (e_llc->ctl == 0x03) ) { | ||
436 | WLAN_LOG_DEBUG(3, "802.1h/RFC1042 len: %d\n", payload_length); | ||
437 | /* it's an 802.1h frame || (an RFC1042 && protocol is not in STT) */ | ||
438 | /* build a DIXII + RFC894 */ | ||
439 | |||
440 | /* Test for an overlength frame */ | ||
441 | if ((payload_length - sizeof(wlan_llc_t) - sizeof(wlan_snap_t)) | ||
442 | > netdev->mtu) { | ||
443 | /* A bogus length ethfrm has been sent. */ | ||
444 | /* Is someone trying an oflow attack? */ | ||
445 | WLAN_LOG_ERROR("DIXII frame too large (%ld > %d)\n", | ||
446 | (long int) (payload_length - sizeof(wlan_llc_t) - | ||
447 | sizeof(wlan_snap_t)), | ||
448 | netdev->mtu); | ||
449 | return 1; | ||
450 | } | ||
451 | |||
452 | /* chop 802.11 header from skb. */ | ||
453 | skb_pull(skb, payload_offset); | ||
454 | |||
455 | /* chop llc header from skb. */ | ||
456 | skb_pull(skb, sizeof(wlan_llc_t)); | ||
457 | |||
458 | /* chop snap header from skb. */ | ||
459 | skb_pull(skb, sizeof(wlan_snap_t)); | ||
460 | |||
461 | /* create 802.3 header at beginning of skb. */ | ||
462 | e_hdr = (wlan_ethhdr_t *) skb_push(skb, WLAN_ETHHDR_LEN); | ||
463 | e_hdr->type = e_snap->type; | ||
464 | memcpy(e_hdr->daddr, daddr, WLAN_ETHADDR_LEN); | ||
465 | memcpy(e_hdr->saddr, saddr, WLAN_ETHADDR_LEN); | ||
466 | |||
467 | /* chop off the 802.11 CRC */ | ||
468 | skb_trim(skb, skb->len - WLAN_CRC_LEN); | ||
469 | } else { | ||
470 | WLAN_LOG_DEBUG(3, "NON-ENCAP len: %d\n", payload_length); | ||
471 | /* any NON-ENCAP */ | ||
472 | /* it's a generic 80211+LLC or IPX 'Raw 802.3' */ | ||
473 | /* build an 802.3 frame */ | ||
474 | /* allocate space and setup hostbuf */ | ||
475 | |||
476 | /* Test for an overlength frame */ | ||
477 | if ( payload_length > netdev->mtu ) { | ||
478 | /* A bogus length ethfrm has been sent. */ | ||
479 | /* Is someone trying an oflow attack? */ | ||
480 | WLAN_LOG_ERROR("OTHER frame too large (%d > %d)\n", | ||
481 | payload_length, | ||
482 | netdev->mtu); | ||
483 | return 1; | ||
484 | } | ||
485 | |||
486 | /* Chop off the 802.11 header. */ | ||
487 | skb_pull(skb, payload_offset); | ||
488 | |||
489 | /* create 802.3 header at beginning of skb. */ | ||
490 | e_hdr = (wlan_ethhdr_t *) skb_push(skb, WLAN_ETHHDR_LEN); | ||
491 | memcpy(e_hdr->daddr, daddr, WLAN_ETHADDR_LEN); | ||
492 | memcpy(e_hdr->saddr, saddr, WLAN_ETHADDR_LEN); | ||
493 | e_hdr->type = htons(payload_length); | ||
494 | |||
495 | /* chop off the 802.11 CRC */ | ||
496 | skb_trim(skb, skb->len - WLAN_CRC_LEN); | ||
497 | |||
498 | } | ||
499 | |||
500 | skb->protocol = eth_type_trans(skb, netdev); | ||
501 | skb_reset_mac_header(skb); | ||
502 | |||
503 | /* jkriegl: process signal and noise as set in hfa384x_int_rx() */ | ||
504 | /* jkriegl: only process signal/noise if requested by iwspy */ | ||
505 | if (wlandev->spy_number) | ||
506 | orinoco_spy_gather(wlandev, eth_hdr(skb)->h_source, P80211SKB_RXMETA(skb)); | ||
507 | |||
508 | /* Free the metadata */ | ||
509 | p80211skb_rxmeta_detach(skb); | ||
510 | |||
511 | DBFEXIT; | ||
512 | return 0; | ||
513 | } | ||
514 | |||
515 | /*---------------------------------------------------------------- | ||
516 | * p80211_stt_findproto | ||
517 | * | ||
518 | * Searches the 802.1h Selective Translation Table for a given | ||
519 | * protocol. | ||
520 | * | ||
521 | * Arguments: | ||
522 | * proto protocl number (in host order) to search for. | ||
523 | * | ||
524 | * Returns: | ||
525 | * 1 - if the table is empty or a match is found. | ||
526 | * 0 - if the table is non-empty and a match is not found. | ||
527 | * | ||
528 | * Call context: | ||
529 | * May be called in interrupt or non-interrupt context | ||
530 | ----------------------------------------------------------------*/ | ||
531 | int p80211_stt_findproto(UINT16 proto) | ||
532 | { | ||
533 | /* Always return found for now. This is the behavior used by the */ | ||
534 | /* Zoom Win95 driver when 802.1h mode is selected */ | ||
535 | /* TODO: If necessary, add an actual search we'll probably | ||
536 | need this to match the CMAC's way of doing things. | ||
537 | Need to do some testing to confirm. | ||
538 | */ | ||
539 | |||
540 | if (proto == 0x80f3) /* APPLETALK */ | ||
541 | return 1; | ||
542 | |||
543 | return 0; | ||
544 | } | ||
545 | |||
546 | /*---------------------------------------------------------------- | ||
547 | * p80211skb_rxmeta_detach | ||
548 | * | ||
549 | * Disconnects the frmmeta and rxmeta from an skb. | ||
550 | * | ||
551 | * Arguments: | ||
552 | * wlandev The wlandev this skb belongs to. | ||
553 | * skb The skb we're attaching to. | ||
554 | * | ||
555 | * Returns: | ||
556 | * 0 on success, non-zero otherwise | ||
557 | * | ||
558 | * Call context: | ||
559 | * May be called in interrupt or non-interrupt context | ||
560 | ----------------------------------------------------------------*/ | ||
561 | void | ||
562 | p80211skb_rxmeta_detach(struct sk_buff *skb) | ||
563 | { | ||
564 | p80211_rxmeta_t *rxmeta; | ||
565 | p80211_frmmeta_t *frmmeta; | ||
566 | |||
567 | DBFENTER; | ||
568 | /* Sanity checks */ | ||
569 | if ( skb==NULL ) { /* bad skb */ | ||
570 | WLAN_LOG_DEBUG(1, "Called w/ null skb.\n"); | ||
571 | goto exit; | ||
572 | } | ||
573 | frmmeta = P80211SKB_FRMMETA(skb); | ||
574 | if ( frmmeta == NULL ) { /* no magic */ | ||
575 | WLAN_LOG_DEBUG(1, "Called w/ bad frmmeta magic.\n"); | ||
576 | goto exit; | ||
577 | } | ||
578 | rxmeta = frmmeta->rx; | ||
579 | if ( rxmeta == NULL ) { /* bad meta ptr */ | ||
580 | WLAN_LOG_DEBUG(1, "Called w/ bad rxmeta ptr.\n"); | ||
581 | goto exit; | ||
582 | } | ||
583 | |||
584 | /* Free rxmeta */ | ||
585 | kfree(rxmeta); | ||
586 | |||
587 | /* Clear skb->cb */ | ||
588 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
589 | exit: | ||
590 | DBFEXIT; | ||
591 | return; | ||
592 | } | ||
593 | |||
594 | /*---------------------------------------------------------------- | ||
595 | * p80211skb_rxmeta_attach | ||
596 | * | ||
597 | * Allocates a p80211rxmeta structure, initializes it, and attaches | ||
598 | * it to an skb. | ||
599 | * | ||
600 | * Arguments: | ||
601 | * wlandev The wlandev this skb belongs to. | ||
602 | * skb The skb we're attaching to. | ||
603 | * | ||
604 | * Returns: | ||
605 | * 0 on success, non-zero otherwise | ||
606 | * | ||
607 | * Call context: | ||
608 | * May be called in interrupt or non-interrupt context | ||
609 | ----------------------------------------------------------------*/ | ||
610 | int | ||
611 | p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) | ||
612 | { | ||
613 | int result = 0; | ||
614 | p80211_rxmeta_t *rxmeta; | ||
615 | p80211_frmmeta_t *frmmeta; | ||
616 | |||
617 | DBFENTER; | ||
618 | |||
619 | /* If these already have metadata, we error out! */ | ||
620 | if (P80211SKB_RXMETA(skb) != NULL) { | ||
621 | WLAN_LOG_ERROR("%s: RXmeta already attached!\n", | ||
622 | wlandev->name); | ||
623 | result = 0; | ||
624 | goto exit; | ||
625 | } | ||
626 | |||
627 | /* Allocate the rxmeta */ | ||
628 | rxmeta = kmalloc(sizeof(p80211_rxmeta_t), GFP_ATOMIC); | ||
629 | |||
630 | if ( rxmeta == NULL ) { | ||
631 | WLAN_LOG_ERROR("%s: Failed to allocate rxmeta.\n", | ||
632 | wlandev->name); | ||
633 | result = 1; | ||
634 | goto exit; | ||
635 | } | ||
636 | |||
637 | /* Initialize the rxmeta */ | ||
638 | memset(rxmeta, 0, sizeof(p80211_rxmeta_t)); | ||
639 | rxmeta->wlandev = wlandev; | ||
640 | rxmeta->hosttime = jiffies; | ||
641 | |||
642 | /* Overlay a frmmeta_t onto skb->cb */ | ||
643 | memset(skb->cb, 0, sizeof(p80211_frmmeta_t)); | ||
644 | frmmeta = (p80211_frmmeta_t*)(skb->cb); | ||
645 | frmmeta->magic = P80211_FRMMETA_MAGIC; | ||
646 | frmmeta->rx = rxmeta; | ||
647 | exit: | ||
648 | DBFEXIT; | ||
649 | return result; | ||
650 | } | ||
651 | |||
652 | /*---------------------------------------------------------------- | ||
653 | * p80211skb_free | ||
654 | * | ||
655 | * Frees an entire p80211skb by checking and freeing the meta struct | ||
656 | * and then freeing the skb. | ||
657 | * | ||
658 | * Arguments: | ||
659 | * wlandev The wlandev this skb belongs to. | ||
660 | * skb The skb we're attaching to. | ||
661 | * | ||
662 | * Returns: | ||
663 | * 0 on success, non-zero otherwise | ||
664 | * | ||
665 | * Call context: | ||
666 | * May be called in interrupt or non-interrupt context | ||
667 | ----------------------------------------------------------------*/ | ||
668 | void | ||
669 | p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb) | ||
670 | { | ||
671 | p80211_frmmeta_t *meta; | ||
672 | DBFENTER; | ||
673 | meta = P80211SKB_FRMMETA(skb); | ||
674 | if ( meta && meta->rx) { | ||
675 | p80211skb_rxmeta_detach(skb); | ||
676 | } else { | ||
677 | WLAN_LOG_ERROR("Freeing an skb (%p) w/ no frmmeta.\n", skb); | ||
678 | } | ||
679 | |||
680 | dev_kfree_skb(skb); | ||
681 | DBFEXIT; | ||
682 | return; | ||
683 | } | ||
diff --git a/drivers/staging/wlan-ng/p80211conv.h b/drivers/staging/wlan-ng/p80211conv.h new file mode 100644 index 000000000000..3f5ab57cd9a8 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211conv.h | |||
@@ -0,0 +1,186 @@ | |||
1 | /* p80211conv.h | ||
2 | * | ||
3 | * Ether/802.11 conversions and packet buffer routines | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares the functions, types and macros that perform | ||
48 | * Ethernet to/from 802.11 frame conversions. | ||
49 | * | ||
50 | * -------------------------------------------------------------------- | ||
51 | */ | ||
52 | |||
53 | #ifndef _LINUX_P80211CONV_H | ||
54 | #define _LINUX_P80211CONV_H | ||
55 | |||
56 | /*================================================================*/ | ||
57 | /* Constants */ | ||
58 | |||
59 | #define WLAN_ETHADDR_LEN 6 | ||
60 | #define WLAN_IEEE_OUI_LEN 3 | ||
61 | |||
62 | #define WLAN_ETHCONV_ENCAP 1 | ||
63 | #define WLAN_ETHCONV_RFC1042 2 | ||
64 | #define WLAN_ETHCONV_8021h 3 | ||
65 | |||
66 | #define WLAN_MIN_ETHFRM_LEN 60 | ||
67 | #define WLAN_MAX_ETHFRM_LEN 1514 | ||
68 | #define WLAN_ETHHDR_LEN 14 | ||
69 | |||
70 | #define P80211CAPTURE_VERSION 0x80211001 | ||
71 | |||
72 | /*================================================================*/ | ||
73 | /* Macros */ | ||
74 | |||
75 | #define P80211_FRMMETA_MAGIC 0x802110 | ||
76 | |||
77 | #define P80211SKB_FRMMETA(s) \ | ||
78 | (((((p80211_frmmeta_t*)((s)->cb))->magic)==P80211_FRMMETA_MAGIC) ? \ | ||
79 | ((p80211_frmmeta_t*)((s)->cb)) : \ | ||
80 | (NULL)) | ||
81 | |||
82 | #define P80211SKB_RXMETA(s) \ | ||
83 | (P80211SKB_FRMMETA((s)) ? P80211SKB_FRMMETA((s))->rx : ((p80211_rxmeta_t*)(NULL))) | ||
84 | |||
85 | typedef struct p80211_rxmeta | ||
86 | { | ||
87 | struct wlandevice *wlandev; | ||
88 | |||
89 | UINT64 mactime; /* Hi-rez MAC-supplied time value */ | ||
90 | UINT64 hosttime; /* Best-rez host supplied time value */ | ||
91 | |||
92 | UINT rxrate; /* Receive data rate in 100kbps */ | ||
93 | UINT priority; /* 0-15, 0=contention, 6=CF */ | ||
94 | INT signal; /* An SSI, see p80211netdev.h */ | ||
95 | INT noise; /* An SSI, see p80211netdev.h */ | ||
96 | UINT channel; /* Receive channel (mostly for snifs) */ | ||
97 | UINT preamble; /* P80211ENUM_preambletype_* */ | ||
98 | UINT encoding; /* P80211ENUM_encoding_* */ | ||
99 | |||
100 | } p80211_rxmeta_t; | ||
101 | |||
102 | typedef struct p80211_frmmeta | ||
103 | { | ||
104 | UINT magic; | ||
105 | p80211_rxmeta_t *rx; | ||
106 | } p80211_frmmeta_t; | ||
107 | |||
108 | void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb); | ||
109 | int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb); | ||
110 | void p80211skb_rxmeta_detach(struct sk_buff *skb); | ||
111 | |||
112 | /*================================================================*/ | ||
113 | /* Types */ | ||
114 | |||
115 | /* | ||
116 | * Frame capture header. (See doc/capturefrm.txt) | ||
117 | */ | ||
118 | typedef struct p80211_caphdr | ||
119 | { | ||
120 | UINT32 version; | ||
121 | UINT32 length; | ||
122 | UINT64 mactime; | ||
123 | UINT64 hosttime; | ||
124 | UINT32 phytype; | ||
125 | UINT32 channel; | ||
126 | UINT32 datarate; | ||
127 | UINT32 antenna; | ||
128 | UINT32 priority; | ||
129 | UINT32 ssi_type; | ||
130 | INT32 ssi_signal; | ||
131 | INT32 ssi_noise; | ||
132 | UINT32 preamble; | ||
133 | UINT32 encoding; | ||
134 | } p80211_caphdr_t; | ||
135 | |||
136 | /* buffer free method pointer type */ | ||
137 | typedef void (* freebuf_method_t)(void *buf, int size); | ||
138 | |||
139 | typedef struct p80211_metawep { | ||
140 | void *data; | ||
141 | UINT8 iv[4]; | ||
142 | UINT8 icv[4]; | ||
143 | } p80211_metawep_t; | ||
144 | |||
145 | /* local ether header type */ | ||
146 | typedef struct wlan_ethhdr | ||
147 | { | ||
148 | UINT8 daddr[WLAN_ETHADDR_LEN]; | ||
149 | UINT8 saddr[WLAN_ETHADDR_LEN]; | ||
150 | UINT16 type; | ||
151 | } __WLAN_ATTRIB_PACK__ wlan_ethhdr_t; | ||
152 | |||
153 | /* local llc header type */ | ||
154 | typedef struct wlan_llc | ||
155 | { | ||
156 | UINT8 dsap; | ||
157 | UINT8 ssap; | ||
158 | UINT8 ctl; | ||
159 | } __WLAN_ATTRIB_PACK__ wlan_llc_t; | ||
160 | |||
161 | /* local snap header type */ | ||
162 | typedef struct wlan_snap | ||
163 | { | ||
164 | UINT8 oui[WLAN_IEEE_OUI_LEN]; | ||
165 | UINT16 type; | ||
166 | } __WLAN_ATTRIB_PACK__ wlan_snap_t; | ||
167 | |||
168 | /* Circular include trick */ | ||
169 | struct wlandevice; | ||
170 | |||
171 | /*================================================================*/ | ||
172 | /* Externs */ | ||
173 | |||
174 | /*================================================================*/ | ||
175 | /*Function Declarations */ | ||
176 | |||
177 | int skb_p80211_to_ether( struct wlandevice *wlandev, UINT32 ethconv, | ||
178 | struct sk_buff *skb); | ||
179 | int skb_ether_to_p80211( struct wlandevice *wlandev, UINT32 ethconv, | ||
180 | struct sk_buff *skb, p80211_hdr_t *p80211_hdr, | ||
181 | p80211_metawep_t *p80211_wep ); | ||
182 | |||
183 | int p80211_stt_findproto(UINT16 proto); | ||
184 | int p80211_stt_addproto(UINT16 proto); | ||
185 | |||
186 | #endif | ||
diff --git a/drivers/staging/wlan-ng/p80211hdr.h b/drivers/staging/wlan-ng/p80211hdr.h new file mode 100644 index 000000000000..b7b0872fd861 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211hdr.h | |||
@@ -0,0 +1,299 @@ | |||
1 | /* p80211hdr.h | ||
2 | * | ||
3 | * Macros, types, and functions for handling 802.11 MAC headers | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares the constants and types used in the interface | ||
48 | * between a wlan driver and the user mode utilities. | ||
49 | * | ||
50 | * Note: | ||
51 | * - Constant values are always in HOST byte order. To assign | ||
52 | * values to multi-byte fields they _must_ be converted to | ||
53 | * ieee byte order. To retrieve multi-byte values from incoming | ||
54 | * frames, they must be converted to host order. | ||
55 | * | ||
56 | * All functions declared here are implemented in p80211.c | ||
57 | * -------------------------------------------------------------------- | ||
58 | */ | ||
59 | |||
60 | #ifndef _P80211HDR_H | ||
61 | #define _P80211HDR_H | ||
62 | |||
63 | /*================================================================*/ | ||
64 | /* System Includes */ | ||
65 | |||
66 | /*================================================================*/ | ||
67 | /* Project Includes */ | ||
68 | |||
69 | #ifndef _WLAN_COMPAT_H | ||
70 | #include "wlan_compat.h" | ||
71 | #endif | ||
72 | |||
73 | |||
74 | /*================================================================*/ | ||
75 | /* Constants */ | ||
76 | |||
77 | /*--- Sizes -----------------------------------------------*/ | ||
78 | #define WLAN_ADDR_LEN 6 | ||
79 | #define WLAN_CRC_LEN 4 | ||
80 | #define WLAN_BSSID_LEN 6 | ||
81 | #define WLAN_BSS_TS_LEN 8 | ||
82 | #define WLAN_HDR_A3_LEN 24 | ||
83 | #define WLAN_HDR_A4_LEN 30 | ||
84 | #define WLAN_SSID_MAXLEN 32 | ||
85 | #define WLAN_DATA_MAXLEN 2312 | ||
86 | #define WLAN_A3FR_MAXLEN (WLAN_HDR_A3_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) | ||
87 | #define WLAN_A4FR_MAXLEN (WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN) | ||
88 | #define WLAN_BEACON_FR_MAXLEN (WLAN_HDR_A3_LEN + 334) | ||
89 | #define WLAN_ATIM_FR_MAXLEN (WLAN_HDR_A3_LEN + 0) | ||
90 | #define WLAN_DISASSOC_FR_MAXLEN (WLAN_HDR_A3_LEN + 2) | ||
91 | #define WLAN_ASSOCREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 48) | ||
92 | #define WLAN_ASSOCRESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 16) | ||
93 | #define WLAN_REASSOCREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 54) | ||
94 | #define WLAN_REASSOCRESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 16) | ||
95 | #define WLAN_PROBEREQ_FR_MAXLEN (WLAN_HDR_A3_LEN + 44) | ||
96 | #define WLAN_PROBERESP_FR_MAXLEN (WLAN_HDR_A3_LEN + 78) | ||
97 | #define WLAN_AUTHEN_FR_MAXLEN (WLAN_HDR_A3_LEN + 261) | ||
98 | #define WLAN_DEAUTHEN_FR_MAXLEN (WLAN_HDR_A3_LEN + 2) | ||
99 | #define WLAN_WEP_NKEYS 4 | ||
100 | #define WLAN_WEP_MAXKEYLEN 13 | ||
101 | #define WLAN_CHALLENGE_IE_LEN 130 | ||
102 | #define WLAN_CHALLENGE_LEN 128 | ||
103 | #define WLAN_WEP_IV_LEN 4 | ||
104 | #define WLAN_WEP_ICV_LEN 4 | ||
105 | |||
106 | /*--- Frame Control Field -------------------------------------*/ | ||
107 | /* Frame Types */ | ||
108 | #define WLAN_FTYPE_MGMT 0x00 | ||
109 | #define WLAN_FTYPE_CTL 0x01 | ||
110 | #define WLAN_FTYPE_DATA 0x02 | ||
111 | |||
112 | /* Frame subtypes */ | ||
113 | /* Management */ | ||
114 | #define WLAN_FSTYPE_ASSOCREQ 0x00 | ||
115 | #define WLAN_FSTYPE_ASSOCRESP 0x01 | ||
116 | #define WLAN_FSTYPE_REASSOCREQ 0x02 | ||
117 | #define WLAN_FSTYPE_REASSOCRESP 0x03 | ||
118 | #define WLAN_FSTYPE_PROBEREQ 0x04 | ||
119 | #define WLAN_FSTYPE_PROBERESP 0x05 | ||
120 | #define WLAN_FSTYPE_BEACON 0x08 | ||
121 | #define WLAN_FSTYPE_ATIM 0x09 | ||
122 | #define WLAN_FSTYPE_DISASSOC 0x0a | ||
123 | #define WLAN_FSTYPE_AUTHEN 0x0b | ||
124 | #define WLAN_FSTYPE_DEAUTHEN 0x0c | ||
125 | |||
126 | /* Control */ | ||
127 | #define WLAN_FSTYPE_BLOCKACKREQ 0x8 | ||
128 | #define WLAN_FSTYPE_BLOCKACK 0x9 | ||
129 | #define WLAN_FSTYPE_PSPOLL 0x0a | ||
130 | #define WLAN_FSTYPE_RTS 0x0b | ||
131 | #define WLAN_FSTYPE_CTS 0x0c | ||
132 | #define WLAN_FSTYPE_ACK 0x0d | ||
133 | #define WLAN_FSTYPE_CFEND 0x0e | ||
134 | #define WLAN_FSTYPE_CFENDCFACK 0x0f | ||
135 | |||
136 | /* Data */ | ||
137 | #define WLAN_FSTYPE_DATAONLY 0x00 | ||
138 | #define WLAN_FSTYPE_DATA_CFACK 0x01 | ||
139 | #define WLAN_FSTYPE_DATA_CFPOLL 0x02 | ||
140 | #define WLAN_FSTYPE_DATA_CFACK_CFPOLL 0x03 | ||
141 | #define WLAN_FSTYPE_NULL 0x04 | ||
142 | #define WLAN_FSTYPE_CFACK 0x05 | ||
143 | #define WLAN_FSTYPE_CFPOLL 0x06 | ||
144 | #define WLAN_FSTYPE_CFACK_CFPOLL 0x07 | ||
145 | |||
146 | |||
147 | /*================================================================*/ | ||
148 | /* Macros */ | ||
149 | |||
150 | /*--- FC Macros ----------------------------------------------*/ | ||
151 | /* Macros to get/set the bitfields of the Frame Control Field */ | ||
152 | /* GET_FC_??? - takes the host byte-order value of an FC */ | ||
153 | /* and retrieves the value of one of the */ | ||
154 | /* bitfields and moves that value so its lsb is */ | ||
155 | /* in bit 0. */ | ||
156 | /* SET_FC_??? - takes a host order value for one of the FC */ | ||
157 | /* bitfields and moves it to the proper bit */ | ||
158 | /* location for ORing into a host order FC. */ | ||
159 | /* To send the FC produced from SET_FC_???, */ | ||
160 | /* one must put the bytes in IEEE order. */ | ||
161 | /* e.g. */ | ||
162 | /* printf("the frame subtype is %x", */ | ||
163 | /* GET_FC_FTYPE( ieee2host( rx.fc ))) */ | ||
164 | /* */ | ||
165 | /* tx.fc = host2ieee( SET_FC_FTYPE(WLAN_FTYP_CTL) | */ | ||
166 | /* SET_FC_FSTYPE(WLAN_FSTYPE_RTS) ); */ | ||
167 | /*------------------------------------------------------------*/ | ||
168 | |||
169 | #define WLAN_GET_FC_PVER(n) (((UINT16)(n)) & (BIT0 | BIT1)) | ||
170 | #define WLAN_GET_FC_FTYPE(n) ((((UINT16)(n)) & (BIT2 | BIT3)) >> 2) | ||
171 | #define WLAN_GET_FC_FSTYPE(n) ((((UINT16)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4) | ||
172 | #define WLAN_GET_FC_TODS(n) ((((UINT16)(n)) & (BIT8)) >> 8) | ||
173 | #define WLAN_GET_FC_FROMDS(n) ((((UINT16)(n)) & (BIT9)) >> 9) | ||
174 | #define WLAN_GET_FC_MOREFRAG(n) ((((UINT16)(n)) & (BIT10)) >> 10) | ||
175 | #define WLAN_GET_FC_RETRY(n) ((((UINT16)(n)) & (BIT11)) >> 11) | ||
176 | #define WLAN_GET_FC_PWRMGT(n) ((((UINT16)(n)) & (BIT12)) >> 12) | ||
177 | #define WLAN_GET_FC_MOREDATA(n) ((((UINT16)(n)) & (BIT13)) >> 13) | ||
178 | #define WLAN_GET_FC_ISWEP(n) ((((UINT16)(n)) & (BIT14)) >> 14) | ||
179 | #define WLAN_GET_FC_ORDER(n) ((((UINT16)(n)) & (BIT15)) >> 15) | ||
180 | |||
181 | #define WLAN_SET_FC_PVER(n) ((UINT16)(n)) | ||
182 | #define WLAN_SET_FC_FTYPE(n) (((UINT16)(n)) << 2) | ||
183 | #define WLAN_SET_FC_FSTYPE(n) (((UINT16)(n)) << 4) | ||
184 | #define WLAN_SET_FC_TODS(n) (((UINT16)(n)) << 8) | ||
185 | #define WLAN_SET_FC_FROMDS(n) (((UINT16)(n)) << 9) | ||
186 | #define WLAN_SET_FC_MOREFRAG(n) (((UINT16)(n)) << 10) | ||
187 | #define WLAN_SET_FC_RETRY(n) (((UINT16)(n)) << 11) | ||
188 | #define WLAN_SET_FC_PWRMGT(n) (((UINT16)(n)) << 12) | ||
189 | #define WLAN_SET_FC_MOREDATA(n) (((UINT16)(n)) << 13) | ||
190 | #define WLAN_SET_FC_ISWEP(n) (((UINT16)(n)) << 14) | ||
191 | #define WLAN_SET_FC_ORDER(n) (((UINT16)(n)) << 15) | ||
192 | |||
193 | /*--- Duration Macros ----------------------------------------*/ | ||
194 | /* Macros to get/set the bitfields of the Duration Field */ | ||
195 | /* - the duration value is only valid when bit15 is zero */ | ||
196 | /* - the firmware handles these values, so I'm not going */ | ||
197 | /* these macros right now. */ | ||
198 | /*------------------------------------------------------------*/ | ||
199 | |||
200 | /*--- Sequence Control Macros -------------------------------*/ | ||
201 | /* Macros to get/set the bitfields of the Sequence Control */ | ||
202 | /* Field. */ | ||
203 | /*------------------------------------------------------------*/ | ||
204 | #define WLAN_GET_SEQ_FRGNUM(n) (((UINT16)(n)) & (BIT0|BIT1|BIT2|BIT3)) | ||
205 | #define WLAN_GET_SEQ_SEQNUM(n) ((((UINT16)(n)) & (~(BIT0|BIT1|BIT2|BIT3))) >> 4) | ||
206 | |||
207 | /*--- Data ptr macro -----------------------------------------*/ | ||
208 | /* Creates a UINT8* to the data portion of a frame */ | ||
209 | /* Assumes you're passing in a ptr to the beginning of the hdr*/ | ||
210 | /*------------------------------------------------------------*/ | ||
211 | #define WLAN_HDR_A3_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A3_LEN) | ||
212 | #define WLAN_HDR_A4_DATAP(p) (((UINT8*)(p)) + WLAN_HDR_A4_LEN) | ||
213 | |||
214 | #define DOT11_RATE5_ISBASIC_GET(r) (((UINT8)(r)) & BIT7) | ||
215 | |||
216 | /*================================================================*/ | ||
217 | /* Types */ | ||
218 | |||
219 | /* BSS Timestamp */ | ||
220 | typedef UINT8 wlan_bss_ts_t[WLAN_BSS_TS_LEN]; | ||
221 | |||
222 | /* Generic 802.11 Header types */ | ||
223 | |||
224 | typedef struct p80211_hdr_a3 | ||
225 | { | ||
226 | UINT16 fc; | ||
227 | UINT16 dur; | ||
228 | UINT8 a1[WLAN_ADDR_LEN]; | ||
229 | UINT8 a2[WLAN_ADDR_LEN]; | ||
230 | UINT8 a3[WLAN_ADDR_LEN]; | ||
231 | UINT16 seq; | ||
232 | } __WLAN_ATTRIB_PACK__ p80211_hdr_a3_t; | ||
233 | |||
234 | typedef struct p80211_hdr_a4 | ||
235 | { | ||
236 | UINT16 fc; | ||
237 | UINT16 dur; | ||
238 | UINT8 a1[WLAN_ADDR_LEN]; | ||
239 | UINT8 a2[WLAN_ADDR_LEN]; | ||
240 | UINT8 a3[WLAN_ADDR_LEN]; | ||
241 | UINT16 seq; | ||
242 | UINT8 a4[WLAN_ADDR_LEN]; | ||
243 | } __WLAN_ATTRIB_PACK__ p80211_hdr_a4_t; | ||
244 | |||
245 | typedef union p80211_hdr | ||
246 | { | ||
247 | p80211_hdr_a3_t a3; | ||
248 | p80211_hdr_a4_t a4; | ||
249 | } __WLAN_ATTRIB_PACK__ p80211_hdr_t; | ||
250 | |||
251 | |||
252 | /*================================================================*/ | ||
253 | /* Extern Declarations */ | ||
254 | |||
255 | |||
256 | /*================================================================*/ | ||
257 | /* Function Declarations */ | ||
258 | |||
259 | /* Frame and header lenght macros */ | ||
260 | |||
261 | #define WLAN_CTL_FRAMELEN(fstype) (\ | ||
262 | (fstype) == WLAN_FSTYPE_BLOCKACKREQ ? 24 : \ | ||
263 | (fstype) == WLAN_FSTYPE_BLOCKACK ? 152 : \ | ||
264 | (fstype) == WLAN_FSTYPE_PSPOLL ? 20 : \ | ||
265 | (fstype) == WLAN_FSTYPE_RTS ? 20 : \ | ||
266 | (fstype) == WLAN_FSTYPE_CTS ? 14 : \ | ||
267 | (fstype) == WLAN_FSTYPE_ACK ? 14 : \ | ||
268 | (fstype) == WLAN_FSTYPE_CFEND ? 20 : \ | ||
269 | (fstype) == WLAN_FSTYPE_CFENDCFACK ? 20 : 4) | ||
270 | |||
271 | #define WLAN_FCS_LEN 4 | ||
272 | |||
273 | /* ftcl in HOST order */ | ||
274 | inline static UINT16 p80211_headerlen(UINT16 fctl) | ||
275 | { | ||
276 | UINT16 hdrlen = 0; | ||
277 | |||
278 | switch ( WLAN_GET_FC_FTYPE(fctl) ) { | ||
279 | case WLAN_FTYPE_MGMT: | ||
280 | hdrlen = WLAN_HDR_A3_LEN; | ||
281 | break; | ||
282 | case WLAN_FTYPE_DATA: | ||
283 | hdrlen = WLAN_HDR_A3_LEN; | ||
284 | if ( WLAN_GET_FC_TODS(fctl) && WLAN_GET_FC_FROMDS(fctl) ) { | ||
285 | hdrlen += WLAN_ADDR_LEN; | ||
286 | } | ||
287 | break; | ||
288 | case WLAN_FTYPE_CTL: | ||
289 | hdrlen = WLAN_CTL_FRAMELEN(WLAN_GET_FC_FSTYPE(fctl)) - | ||
290 | WLAN_FCS_LEN; | ||
291 | break; | ||
292 | default: | ||
293 | hdrlen = WLAN_HDR_A3_LEN; | ||
294 | } | ||
295 | |||
296 | return hdrlen; | ||
297 | } | ||
298 | |||
299 | #endif /* _P80211HDR_H */ | ||
diff --git a/drivers/staging/wlan-ng/p80211ioctl.h b/drivers/staging/wlan-ng/p80211ioctl.h new file mode 100644 index 000000000000..25b2ea836227 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211ioctl.h | |||
@@ -0,0 +1,123 @@ | |||
1 | /* p80211ioctl.h | ||
2 | * | ||
3 | * Declares constants and types for the p80211 ioctls | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * While this file is called 'ioctl' is purpose goes a little beyond | ||
48 | * that. This file defines the types and contants used to implement | ||
49 | * the p80211 request/confirm/indicate interfaces on Linux. The | ||
50 | * request/confirm interface is, in fact, normally implemented as an | ||
51 | * ioctl. The indicate interface on the other hand, is implemented | ||
52 | * using the Linux 'netlink' interface. | ||
53 | * | ||
54 | * The reason I say that request/confirm is 'normally' implemented | ||
55 | * via ioctl is that we're reserving the right to be able to send | ||
56 | * request commands via the netlink interface. This will be necessary | ||
57 | * if we ever need to send request messages when there aren't any | ||
58 | * wlan network devices present (i.e. sending a message that only p80211 | ||
59 | * cares about. | ||
60 | * -------------------------------------------------------------------- | ||
61 | */ | ||
62 | |||
63 | |||
64 | #ifndef _P80211IOCTL_H | ||
65 | #define _P80211IOCTL_H | ||
66 | |||
67 | /*================================================================*/ | ||
68 | /* Constants */ | ||
69 | |||
70 | /*----------------------------------------------------------------*/ | ||
71 | /* p80211 ioctl "request" codes. See argument 2 of ioctl(2). */ | ||
72 | |||
73 | #define P80211_IFTEST (SIOCDEVPRIVATE + 0) | ||
74 | #define P80211_IFREQ (SIOCDEVPRIVATE + 1) | ||
75 | |||
76 | /*----------------------------------------------------------------*/ | ||
77 | /* Magic number, a quick test to see we're getting the desired struct */ | ||
78 | |||
79 | #define P80211_IOCTL_MAGIC (0x4a2d464dUL) | ||
80 | |||
81 | /*----------------------------------------------------------------*/ | ||
82 | /* Netlink protocol numbers for the indication interface */ | ||
83 | |||
84 | #define P80211_NL_SOCK_IND NETLINK_USERSOCK | ||
85 | |||
86 | /*----------------------------------------------------------------*/ | ||
87 | /* Netlink multicast bits for different types of messages */ | ||
88 | |||
89 | #define P80211_NL_MCAST_GRP_MLME BIT0 /* Local station messages */ | ||
90 | #define P80211_NL_MCAST_GRP_SNIFF BIT1 /* Sniffer messages */ | ||
91 | #define P80211_NL_MCAST_GRP_DIST BIT2 /* Distribution system messages */ | ||
92 | |||
93 | /*================================================================*/ | ||
94 | /* Macros */ | ||
95 | |||
96 | |||
97 | /*================================================================*/ | ||
98 | /* Types */ | ||
99 | |||
100 | /*----------------------------------------------------------------*/ | ||
101 | /* A ptr to the following structure type is passed as the third */ | ||
102 | /* argument to the ioctl system call when issuing a request to */ | ||
103 | /* the p80211 module. */ | ||
104 | |||
105 | typedef struct p80211ioctl_req | ||
106 | { | ||
107 | char name[WLAN_DEVNAMELEN_MAX]; | ||
108 | caddr_t data; | ||
109 | UINT32 magic; | ||
110 | UINT16 len; | ||
111 | UINT32 result; | ||
112 | } __WLAN_ATTRIB_PACK__ p80211ioctl_req_t; | ||
113 | |||
114 | |||
115 | /*================================================================*/ | ||
116 | /* Extern Declarations */ | ||
117 | |||
118 | |||
119 | /*================================================================*/ | ||
120 | /* Function Declarations */ | ||
121 | |||
122 | |||
123 | #endif /* _P80211IOCTL_H */ | ||
diff --git a/drivers/staging/wlan-ng/p80211meta.h b/drivers/staging/wlan-ng/p80211meta.h new file mode 100644 index 000000000000..5cb3f5ada4f5 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211meta.h | |||
@@ -0,0 +1,169 @@ | |||
1 | /* p80211meta.h | ||
2 | * | ||
3 | * Macros, constants, types, and funcs for p80211 metadata | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares some of the constants and types used in various | ||
48 | * parts of the linux-wlan system. | ||
49 | * | ||
50 | * Notes: | ||
51 | * - Constant values are always in HOST byte order. | ||
52 | * | ||
53 | * All functions and statics declared here are implemented in p80211types.c | ||
54 | * -------------------------------------------------------------------- | ||
55 | */ | ||
56 | |||
57 | #ifndef _P80211META_H | ||
58 | #define _P80211META_H | ||
59 | |||
60 | /*================================================================*/ | ||
61 | /* System Includes */ | ||
62 | |||
63 | /*================================================================*/ | ||
64 | /* Project Includes */ | ||
65 | |||
66 | #ifndef _WLAN_COMPAT_H | ||
67 | #include "wlan_compat.h" | ||
68 | #endif | ||
69 | |||
70 | /*================================================================*/ | ||
71 | /* Constants */ | ||
72 | |||
73 | /*----------------------------------------------------------------*/ | ||
74 | /* */ | ||
75 | |||
76 | /*================================================================*/ | ||
77 | /* Macros */ | ||
78 | |||
79 | /*----------------------------------------------------------------*/ | ||
80 | /* The following macros are used to ensure consistent naming */ | ||
81 | /* conventions for all the different metadata lists. */ | ||
82 | |||
83 | #define MKREQMETANAME(name) p80211meta_ ## req ## _ ## name | ||
84 | #define MKINDMETANAME(name) p80211meta_ ## ind ## _ ## name | ||
85 | #define MKMIBMETANAME(name) p80211meta_ ## mib ## _ ## name | ||
86 | #define MKGRPMETANAME(name) p80211meta_ ## grp ## _ ## name | ||
87 | |||
88 | #define MKREQMETASIZE(name) p80211meta_ ## req ## _ ## name ## _ ## size | ||
89 | #define MKINDMETASIZE(name) p80211meta_ ## ind ## _ ## name ## _ ## size | ||
90 | #define MKMIBMETASIZE(name) p80211meta_ ## mib ## _ ## name ## _ ## size | ||
91 | #define MKGRPMETASIZE(name) p80211meta_ ## grp ## _ ## name ## _ ## size | ||
92 | |||
93 | #define GETMETASIZE(aptr) (**((UINT32**)(aptr))) | ||
94 | |||
95 | /*----------------------------------------------------------------*/ | ||
96 | /* The following ifdef depends on the following defines: */ | ||
97 | /* P80211_NOINCLUDESTRINGS - if defined, all metadata name fields */ | ||
98 | /* are empty strings */ | ||
99 | |||
100 | #ifdef P80211_NOINCLUDESTRINGS | ||
101 | #define MKITEMNAME(s) ("") | ||
102 | #else | ||
103 | #define MKITEMNAME(s) (s) | ||
104 | #endif | ||
105 | |||
106 | /*================================================================*/ | ||
107 | /* Types */ | ||
108 | |||
109 | /*----------------------------------------------------------------*/ | ||
110 | /* The following structure types are used for the metadata */ | ||
111 | /* representation of category list metadata, group list metadata, */ | ||
112 | /* and data item metadata for both Mib and Messages. */ | ||
113 | |||
114 | typedef struct p80211meta | ||
115 | { | ||
116 | char *name; /* data item name */ | ||
117 | UINT32 did; /* partial did */ | ||
118 | UINT32 flags; /* set of various flag bits */ | ||
119 | UINT32 min; /* min value of a BOUNDEDINT */ | ||
120 | UINT32 max; /* max value of a BOUNDEDINT */ | ||
121 | |||
122 | UINT32 maxlen; /* maxlen of a OCTETSTR or DISPLAYSTR */ | ||
123 | UINT32 minlen; /* minlen of a OCTETSTR or DISPLAYSTR */ | ||
124 | p80211enum_t *enumptr; /* ptr to the enum type for ENUMINT */ | ||
125 | p80211_totext_t totextptr; /* ptr to totext conversion function */ | ||
126 | p80211_fromtext_t fromtextptr; /* ptr to totext conversion function */ | ||
127 | p80211_valid_t validfunptr; /* ptr to totext conversion function */ | ||
128 | } p80211meta_t; | ||
129 | |||
130 | typedef struct grplistitem | ||
131 | { | ||
132 | char *name; | ||
133 | p80211meta_t *itemlist; | ||
134 | } grplistitem_t; | ||
135 | |||
136 | typedef struct catlistitem | ||
137 | { | ||
138 | char *name; | ||
139 | grplistitem_t *grplist; | ||
140 | } catlistitem_t; | ||
141 | |||
142 | /*================================================================*/ | ||
143 | /* Extern Declarations */ | ||
144 | |||
145 | /*----------------------------------------------------------------*/ | ||
146 | /* */ | ||
147 | |||
148 | /*================================================================*/ | ||
149 | /* Function Declarations */ | ||
150 | |||
151 | /*----------------------------------------------------------------*/ | ||
152 | /* */ | ||
153 | UINT32 p80211_text2did(catlistitem_t *catlist, char *catname, char *grpname, char *itemname); | ||
154 | UINT32 p80211_text2catdid(catlistitem_t *list, char *name ); | ||
155 | UINT32 p80211_text2grpdid(grplistitem_t *list, char *name ); | ||
156 | UINT32 p80211_text2itemdid(p80211meta_t *list, char *name ); | ||
157 | UINT32 p80211_isvalid_did( catlistitem_t *catlist, UINT32 did ); | ||
158 | UINT32 p80211_isvalid_catdid( catlistitem_t *catlist, UINT32 did ); | ||
159 | UINT32 p80211_isvalid_grpdid( catlistitem_t *catlist, UINT32 did ); | ||
160 | UINT32 p80211_isvalid_itemdid( catlistitem_t *catlist, UINT32 did ); | ||
161 | catlistitem_t *p80211_did2cat( catlistitem_t *catlist, UINT32 did ); | ||
162 | grplistitem_t *p80211_did2grp( catlistitem_t *catlist, UINT32 did ); | ||
163 | p80211meta_t *p80211_did2item( catlistitem_t *catlist, UINT32 did ); | ||
164 | UINT32 p80211item_maxdatalen( struct catlistitem *metalist, UINT32 did ); | ||
165 | UINT32 p80211_metaname2did(struct catlistitem *metalist, char *itemname); | ||
166 | UINT32 p80211item_getoffset( struct catlistitem *metalist, UINT32 did ); | ||
167 | int p80211item_gettype(p80211meta_t *meta); | ||
168 | |||
169 | #endif /* _P80211META_H */ | ||
diff --git a/drivers/staging/wlan-ng/p80211metadef.h b/drivers/staging/wlan-ng/p80211metadef.h new file mode 100644 index 000000000000..2c7f435a97e0 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211metadef.h | |||
@@ -0,0 +1,2524 @@ | |||
1 | /* This file is GENERATED AUTOMATICALLY. DO NOT EDIT OR MODIFY. | ||
2 | * -------------------------------------------------------------------- | ||
3 | * | ||
4 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
5 | * -------------------------------------------------------------------- | ||
6 | * | ||
7 | * linux-wlan | ||
8 | * | ||
9 | * The contents of this file are subject to the Mozilla Public | ||
10 | * License Version 1.1 (the "License"); you may not use this file | ||
11 | * except in compliance with the License. You may obtain a copy of | ||
12 | * the License at http://www.mozilla.org/MPL/ | ||
13 | * | ||
14 | * Software distributed under the License is distributed on an "AS | ||
15 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
16 | * implied. See the License for the specific language governing | ||
17 | * rights and limitations under the License. | ||
18 | * | ||
19 | * Alternatively, the contents of this file may be used under the | ||
20 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
21 | * case the provisions of the GPL are applicable instead of the | ||
22 | * above. If you wish to allow the use of your version of this file | ||
23 | * only under the terms of the GPL and not to allow others to use | ||
24 | * your version of this file under the MPL, indicate your decision | ||
25 | * by deleting the provisions above and replace them with the notice | ||
26 | * and other provisions required by the GPL. If you do not delete | ||
27 | * the provisions above, a recipient may use your version of this | ||
28 | * file under either the MPL or the GPL. | ||
29 | * | ||
30 | * -------------------------------------------------------------------- | ||
31 | * | ||
32 | * Inquiries regarding the linux-wlan Open Source project can be | ||
33 | * made directly to: | ||
34 | * | ||
35 | * AbsoluteValue Systems Inc. | ||
36 | * info@linux-wlan.com | ||
37 | * http://www.linux-wlan.com | ||
38 | * | ||
39 | * -------------------------------------------------------------------- | ||
40 | * | ||
41 | * Portions of the development of this software were funded by | ||
42 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
43 | * | ||
44 | * -------------------------------------------------------------------- | ||
45 | */ | ||
46 | |||
47 | #ifndef _P80211MKMETADEF_H | ||
48 | #define _P80211MKMETADEF_H | ||
49 | |||
50 | |||
51 | #define DIDmsg_cat_dot11req \ | ||
52 | P80211DID_MKSECTION(1) | ||
53 | #define DIDmsg_dot11req_mibget \ | ||
54 | (P80211DID_MKSECTION(1) | \ | ||
55 | P80211DID_MKGROUP(1)) | ||
56 | #define DIDmsg_dot11req_mibget_mibattribute \ | ||
57 | (P80211DID_MKSECTION(1) | \ | ||
58 | P80211DID_MKGROUP(1) | \ | ||
59 | P80211DID_MKITEM(1) | 0x00000000) | ||
60 | #define DIDmsg_dot11req_mibget_resultcode \ | ||
61 | (P80211DID_MKSECTION(1) | \ | ||
62 | P80211DID_MKGROUP(1) | \ | ||
63 | P80211DID_MKITEM(2) | 0x00000000) | ||
64 | #define DIDmsg_dot11req_mibset \ | ||
65 | (P80211DID_MKSECTION(1) | \ | ||
66 | P80211DID_MKGROUP(2)) | ||
67 | #define DIDmsg_dot11req_mibset_mibattribute \ | ||
68 | (P80211DID_MKSECTION(1) | \ | ||
69 | P80211DID_MKGROUP(2) | \ | ||
70 | P80211DID_MKITEM(1) | 0x00000000) | ||
71 | #define DIDmsg_dot11req_mibset_resultcode \ | ||
72 | (P80211DID_MKSECTION(1) | \ | ||
73 | P80211DID_MKGROUP(2) | \ | ||
74 | P80211DID_MKITEM(2) | 0x00000000) | ||
75 | #define DIDmsg_dot11req_powermgmt \ | ||
76 | (P80211DID_MKSECTION(1) | \ | ||
77 | P80211DID_MKGROUP(3)) | ||
78 | #define DIDmsg_dot11req_powermgmt_powermgmtmode \ | ||
79 | (P80211DID_MKSECTION(1) | \ | ||
80 | P80211DID_MKGROUP(3) | \ | ||
81 | P80211DID_MKITEM(1) | 0x00000000) | ||
82 | #define DIDmsg_dot11req_powermgmt_wakeup \ | ||
83 | (P80211DID_MKSECTION(1) | \ | ||
84 | P80211DID_MKGROUP(3) | \ | ||
85 | P80211DID_MKITEM(2) | 0x00000000) | ||
86 | #define DIDmsg_dot11req_powermgmt_receivedtims \ | ||
87 | (P80211DID_MKSECTION(1) | \ | ||
88 | P80211DID_MKGROUP(3) | \ | ||
89 | P80211DID_MKITEM(3) | 0x00000000) | ||
90 | #define DIDmsg_dot11req_powermgmt_resultcode \ | ||
91 | (P80211DID_MKSECTION(1) | \ | ||
92 | P80211DID_MKGROUP(3) | \ | ||
93 | P80211DID_MKITEM(4) | 0x00000000) | ||
94 | #define DIDmsg_dot11req_scan \ | ||
95 | (P80211DID_MKSECTION(1) | \ | ||
96 | P80211DID_MKGROUP(4)) | ||
97 | #define DIDmsg_dot11req_scan_bsstype \ | ||
98 | (P80211DID_MKSECTION(1) | \ | ||
99 | P80211DID_MKGROUP(4) | \ | ||
100 | P80211DID_MKITEM(1) | 0x00000000) | ||
101 | #define DIDmsg_dot11req_scan_bssid \ | ||
102 | (P80211DID_MKSECTION(1) | \ | ||
103 | P80211DID_MKGROUP(4) | \ | ||
104 | P80211DID_MKITEM(2) | 0x00000000) | ||
105 | #define DIDmsg_dot11req_scan_ssid \ | ||
106 | (P80211DID_MKSECTION(1) | \ | ||
107 | P80211DID_MKGROUP(4) | \ | ||
108 | P80211DID_MKITEM(3) | 0x00000000) | ||
109 | #define DIDmsg_dot11req_scan_scantype \ | ||
110 | (P80211DID_MKSECTION(1) | \ | ||
111 | P80211DID_MKGROUP(4) | \ | ||
112 | P80211DID_MKITEM(4) | 0x00000000) | ||
113 | #define DIDmsg_dot11req_scan_probedelay \ | ||
114 | (P80211DID_MKSECTION(1) | \ | ||
115 | P80211DID_MKGROUP(4) | \ | ||
116 | P80211DID_MKITEM(5) | 0x00000000) | ||
117 | #define DIDmsg_dot11req_scan_channellist \ | ||
118 | (P80211DID_MKSECTION(1) | \ | ||
119 | P80211DID_MKGROUP(4) | \ | ||
120 | P80211DID_MKITEM(6) | 0x00000000) | ||
121 | #define DIDmsg_dot11req_scan_minchanneltime \ | ||
122 | (P80211DID_MKSECTION(1) | \ | ||
123 | P80211DID_MKGROUP(4) | \ | ||
124 | P80211DID_MKITEM(7) | 0x00000000) | ||
125 | #define DIDmsg_dot11req_scan_maxchanneltime \ | ||
126 | (P80211DID_MKSECTION(1) | \ | ||
127 | P80211DID_MKGROUP(4) | \ | ||
128 | P80211DID_MKITEM(8) | 0x00000000) | ||
129 | #define DIDmsg_dot11req_scan_resultcode \ | ||
130 | (P80211DID_MKSECTION(1) | \ | ||
131 | P80211DID_MKGROUP(4) | \ | ||
132 | P80211DID_MKITEM(9) | 0x00000000) | ||
133 | #define DIDmsg_dot11req_scan_numbss \ | ||
134 | (P80211DID_MKSECTION(1) | \ | ||
135 | P80211DID_MKGROUP(4) | \ | ||
136 | P80211DID_MKITEM(10) | 0x00000000) | ||
137 | #define DIDmsg_dot11req_scan_append \ | ||
138 | (P80211DID_MKSECTION(1) | \ | ||
139 | P80211DID_MKGROUP(4) | \ | ||
140 | P80211DID_MKITEM(11) | 0x00000000) | ||
141 | #define DIDmsg_dot11req_scan_results \ | ||
142 | (P80211DID_MKSECTION(1) | \ | ||
143 | P80211DID_MKGROUP(5)) | ||
144 | #define DIDmsg_dot11req_scan_results_bssindex \ | ||
145 | (P80211DID_MKSECTION(1) | \ | ||
146 | P80211DID_MKGROUP(5) | \ | ||
147 | P80211DID_MKITEM(1) | 0x00000000) | ||
148 | #define DIDmsg_dot11req_scan_results_resultcode \ | ||
149 | (P80211DID_MKSECTION(1) | \ | ||
150 | P80211DID_MKGROUP(5) | \ | ||
151 | P80211DID_MKITEM(2) | 0x00000000) | ||
152 | #define DIDmsg_dot11req_scan_results_signal \ | ||
153 | (P80211DID_MKSECTION(1) | \ | ||
154 | P80211DID_MKGROUP(5) | \ | ||
155 | P80211DID_MKITEM(3) | 0x00000000) | ||
156 | #define DIDmsg_dot11req_scan_results_noise \ | ||
157 | (P80211DID_MKSECTION(1) | \ | ||
158 | P80211DID_MKGROUP(5) | \ | ||
159 | P80211DID_MKITEM(4) | 0x00000000) | ||
160 | #define DIDmsg_dot11req_scan_results_bssid \ | ||
161 | (P80211DID_MKSECTION(1) | \ | ||
162 | P80211DID_MKGROUP(5) | \ | ||
163 | P80211DID_MKITEM(5) | 0x00000000) | ||
164 | #define DIDmsg_dot11req_scan_results_ssid \ | ||
165 | (P80211DID_MKSECTION(1) | \ | ||
166 | P80211DID_MKGROUP(5) | \ | ||
167 | P80211DID_MKITEM(6) | 0x00000000) | ||
168 | #define DIDmsg_dot11req_scan_results_bsstype \ | ||
169 | (P80211DID_MKSECTION(1) | \ | ||
170 | P80211DID_MKGROUP(5) | \ | ||
171 | P80211DID_MKITEM(7) | 0x00000000) | ||
172 | #define DIDmsg_dot11req_scan_results_beaconperiod \ | ||
173 | (P80211DID_MKSECTION(1) | \ | ||
174 | P80211DID_MKGROUP(5) | \ | ||
175 | P80211DID_MKITEM(8) | 0x00000000) | ||
176 | #define DIDmsg_dot11req_scan_results_dtimperiod \ | ||
177 | (P80211DID_MKSECTION(1) | \ | ||
178 | P80211DID_MKGROUP(5) | \ | ||
179 | P80211DID_MKITEM(9) | 0x00000000) | ||
180 | #define DIDmsg_dot11req_scan_results_timestamp \ | ||
181 | (P80211DID_MKSECTION(1) | \ | ||
182 | P80211DID_MKGROUP(5) | \ | ||
183 | P80211DID_MKITEM(10) | 0x00000000) | ||
184 | #define DIDmsg_dot11req_scan_results_localtime \ | ||
185 | (P80211DID_MKSECTION(1) | \ | ||
186 | P80211DID_MKGROUP(5) | \ | ||
187 | P80211DID_MKITEM(11) | 0x00000000) | ||
188 | #define DIDmsg_dot11req_scan_results_fhdwelltime \ | ||
189 | (P80211DID_MKSECTION(1) | \ | ||
190 | P80211DID_MKGROUP(5) | \ | ||
191 | P80211DID_MKITEM(12) | 0x00000000) | ||
192 | #define DIDmsg_dot11req_scan_results_fhhopset \ | ||
193 | (P80211DID_MKSECTION(1) | \ | ||
194 | P80211DID_MKGROUP(5) | \ | ||
195 | P80211DID_MKITEM(13) | 0x00000000) | ||
196 | #define DIDmsg_dot11req_scan_results_fhhoppattern \ | ||
197 | (P80211DID_MKSECTION(1) | \ | ||
198 | P80211DID_MKGROUP(5) | \ | ||
199 | P80211DID_MKITEM(14) | 0x00000000) | ||
200 | #define DIDmsg_dot11req_scan_results_fhhopindex \ | ||
201 | (P80211DID_MKSECTION(1) | \ | ||
202 | P80211DID_MKGROUP(5) | \ | ||
203 | P80211DID_MKITEM(15) | 0x00000000) | ||
204 | #define DIDmsg_dot11req_scan_results_dschannel \ | ||
205 | (P80211DID_MKSECTION(1) | \ | ||
206 | P80211DID_MKGROUP(5) | \ | ||
207 | P80211DID_MKITEM(16) | 0x00000000) | ||
208 | #define DIDmsg_dot11req_scan_results_cfpcount \ | ||
209 | (P80211DID_MKSECTION(1) | \ | ||
210 | P80211DID_MKGROUP(5) | \ | ||
211 | P80211DID_MKITEM(17) | 0x00000000) | ||
212 | #define DIDmsg_dot11req_scan_results_cfpperiod \ | ||
213 | (P80211DID_MKSECTION(1) | \ | ||
214 | P80211DID_MKGROUP(5) | \ | ||
215 | P80211DID_MKITEM(18) | 0x00000000) | ||
216 | #define DIDmsg_dot11req_scan_results_cfpmaxduration \ | ||
217 | (P80211DID_MKSECTION(1) | \ | ||
218 | P80211DID_MKGROUP(5) | \ | ||
219 | P80211DID_MKITEM(19) | 0x00000000) | ||
220 | #define DIDmsg_dot11req_scan_results_cfpdurremaining \ | ||
221 | (P80211DID_MKSECTION(1) | \ | ||
222 | P80211DID_MKGROUP(5) | \ | ||
223 | P80211DID_MKITEM(20) | 0x00000000) | ||
224 | #define DIDmsg_dot11req_scan_results_ibssatimwindow \ | ||
225 | (P80211DID_MKSECTION(1) | \ | ||
226 | P80211DID_MKGROUP(5) | \ | ||
227 | P80211DID_MKITEM(21) | 0x00000000) | ||
228 | #define DIDmsg_dot11req_scan_results_cfpollable \ | ||
229 | (P80211DID_MKSECTION(1) | \ | ||
230 | P80211DID_MKGROUP(5) | \ | ||
231 | P80211DID_MKITEM(22) | 0x00000000) | ||
232 | #define DIDmsg_dot11req_scan_results_cfpollreq \ | ||
233 | (P80211DID_MKSECTION(1) | \ | ||
234 | P80211DID_MKGROUP(5) | \ | ||
235 | P80211DID_MKITEM(23) | 0x00000000) | ||
236 | #define DIDmsg_dot11req_scan_results_privacy \ | ||
237 | (P80211DID_MKSECTION(1) | \ | ||
238 | P80211DID_MKGROUP(5) | \ | ||
239 | P80211DID_MKITEM(24) | 0x00000000) | ||
240 | #define DIDmsg_dot11req_scan_results_basicrate1 \ | ||
241 | (P80211DID_MKSECTION(1) | \ | ||
242 | P80211DID_MKGROUP(5) | \ | ||
243 | P80211DID_MKITEM(25) | 0x00000000) | ||
244 | #define DIDmsg_dot11req_scan_results_basicrate2 \ | ||
245 | (P80211DID_MKSECTION(1) | \ | ||
246 | P80211DID_MKGROUP(5) | \ | ||
247 | P80211DID_MKITEM(26) | 0x00000000) | ||
248 | #define DIDmsg_dot11req_scan_results_basicrate3 \ | ||
249 | (P80211DID_MKSECTION(1) | \ | ||
250 | P80211DID_MKGROUP(5) | \ | ||
251 | P80211DID_MKITEM(27) | 0x00000000) | ||
252 | #define DIDmsg_dot11req_scan_results_basicrate4 \ | ||
253 | (P80211DID_MKSECTION(1) | \ | ||
254 | P80211DID_MKGROUP(5) | \ | ||
255 | P80211DID_MKITEM(28) | 0x00000000) | ||
256 | #define DIDmsg_dot11req_scan_results_basicrate5 \ | ||
257 | (P80211DID_MKSECTION(1) | \ | ||
258 | P80211DID_MKGROUP(5) | \ | ||
259 | P80211DID_MKITEM(29) | 0x00000000) | ||
260 | #define DIDmsg_dot11req_scan_results_basicrate6 \ | ||
261 | (P80211DID_MKSECTION(1) | \ | ||
262 | P80211DID_MKGROUP(5) | \ | ||
263 | P80211DID_MKITEM(30) | 0x00000000) | ||
264 | #define DIDmsg_dot11req_scan_results_basicrate7 \ | ||
265 | (P80211DID_MKSECTION(1) | \ | ||
266 | P80211DID_MKGROUP(5) | \ | ||
267 | P80211DID_MKITEM(31) | 0x00000000) | ||
268 | #define DIDmsg_dot11req_scan_results_basicrate8 \ | ||
269 | (P80211DID_MKSECTION(1) | \ | ||
270 | P80211DID_MKGROUP(5) | \ | ||
271 | P80211DID_MKITEM(32) | 0x00000000) | ||
272 | #define DIDmsg_dot11req_scan_results_supprate1 \ | ||
273 | (P80211DID_MKSECTION(1) | \ | ||
274 | P80211DID_MKGROUP(5) | \ | ||
275 | P80211DID_MKITEM(33) | 0x00000000) | ||
276 | #define DIDmsg_dot11req_scan_results_supprate2 \ | ||
277 | (P80211DID_MKSECTION(1) | \ | ||
278 | P80211DID_MKGROUP(5) | \ | ||
279 | P80211DID_MKITEM(34) | 0x00000000) | ||
280 | #define DIDmsg_dot11req_scan_results_supprate3 \ | ||
281 | (P80211DID_MKSECTION(1) | \ | ||
282 | P80211DID_MKGROUP(5) | \ | ||
283 | P80211DID_MKITEM(35) | 0x00000000) | ||
284 | #define DIDmsg_dot11req_scan_results_supprate4 \ | ||
285 | (P80211DID_MKSECTION(1) | \ | ||
286 | P80211DID_MKGROUP(5) | \ | ||
287 | P80211DID_MKITEM(36) | 0x00000000) | ||
288 | #define DIDmsg_dot11req_scan_results_supprate5 \ | ||
289 | (P80211DID_MKSECTION(1) | \ | ||
290 | P80211DID_MKGROUP(5) | \ | ||
291 | P80211DID_MKITEM(37) | 0x00000000) | ||
292 | #define DIDmsg_dot11req_scan_results_supprate6 \ | ||
293 | (P80211DID_MKSECTION(1) | \ | ||
294 | P80211DID_MKGROUP(5) | \ | ||
295 | P80211DID_MKITEM(38) | 0x00000000) | ||
296 | #define DIDmsg_dot11req_scan_results_supprate7 \ | ||
297 | (P80211DID_MKSECTION(1) | \ | ||
298 | P80211DID_MKGROUP(5) | \ | ||
299 | P80211DID_MKITEM(39) | 0x00000000) | ||
300 | #define DIDmsg_dot11req_scan_results_supprate8 \ | ||
301 | (P80211DID_MKSECTION(1) | \ | ||
302 | P80211DID_MKGROUP(5) | \ | ||
303 | P80211DID_MKITEM(40) | 0x00000000) | ||
304 | #define DIDmsg_dot11req_join \ | ||
305 | (P80211DID_MKSECTION(1) | \ | ||
306 | P80211DID_MKGROUP(6)) | ||
307 | #define DIDmsg_dot11req_join_bssid \ | ||
308 | (P80211DID_MKSECTION(1) | \ | ||
309 | P80211DID_MKGROUP(6) | \ | ||
310 | P80211DID_MKITEM(1) | 0x00000000) | ||
311 | #define DIDmsg_dot11req_join_joinfailuretimeout \ | ||
312 | (P80211DID_MKSECTION(1) | \ | ||
313 | P80211DID_MKGROUP(6) | \ | ||
314 | P80211DID_MKITEM(2) | 0x00000000) | ||
315 | #define DIDmsg_dot11req_join_basicrate1 \ | ||
316 | (P80211DID_MKSECTION(1) | \ | ||
317 | P80211DID_MKGROUP(6) | \ | ||
318 | P80211DID_MKITEM(3) | 0x00000000) | ||
319 | #define DIDmsg_dot11req_join_basicrate2 \ | ||
320 | (P80211DID_MKSECTION(1) | \ | ||
321 | P80211DID_MKGROUP(6) | \ | ||
322 | P80211DID_MKITEM(4) | 0x00000000) | ||
323 | #define DIDmsg_dot11req_join_basicrate3 \ | ||
324 | (P80211DID_MKSECTION(1) | \ | ||
325 | P80211DID_MKGROUP(6) | \ | ||
326 | P80211DID_MKITEM(5) | 0x00000000) | ||
327 | #define DIDmsg_dot11req_join_basicrate4 \ | ||
328 | (P80211DID_MKSECTION(1) | \ | ||
329 | P80211DID_MKGROUP(6) | \ | ||
330 | P80211DID_MKITEM(6) | 0x00000000) | ||
331 | #define DIDmsg_dot11req_join_basicrate5 \ | ||
332 | (P80211DID_MKSECTION(1) | \ | ||
333 | P80211DID_MKGROUP(6) | \ | ||
334 | P80211DID_MKITEM(7) | 0x00000000) | ||
335 | #define DIDmsg_dot11req_join_basicrate6 \ | ||
336 | (P80211DID_MKSECTION(1) | \ | ||
337 | P80211DID_MKGROUP(6) | \ | ||
338 | P80211DID_MKITEM(8) | 0x00000000) | ||
339 | #define DIDmsg_dot11req_join_basicrate7 \ | ||
340 | (P80211DID_MKSECTION(1) | \ | ||
341 | P80211DID_MKGROUP(6) | \ | ||
342 | P80211DID_MKITEM(9) | 0x00000000) | ||
343 | #define DIDmsg_dot11req_join_basicrate8 \ | ||
344 | (P80211DID_MKSECTION(1) | \ | ||
345 | P80211DID_MKGROUP(6) | \ | ||
346 | P80211DID_MKITEM(10) | 0x00000000) | ||
347 | #define DIDmsg_dot11req_join_operationalrate1 \ | ||
348 | (P80211DID_MKSECTION(1) | \ | ||
349 | P80211DID_MKGROUP(6) | \ | ||
350 | P80211DID_MKITEM(11) | 0x00000000) | ||
351 | #define DIDmsg_dot11req_join_operationalrate2 \ | ||
352 | (P80211DID_MKSECTION(1) | \ | ||
353 | P80211DID_MKGROUP(6) | \ | ||
354 | P80211DID_MKITEM(12) | 0x00000000) | ||
355 | #define DIDmsg_dot11req_join_operationalrate3 \ | ||
356 | (P80211DID_MKSECTION(1) | \ | ||
357 | P80211DID_MKGROUP(6) | \ | ||
358 | P80211DID_MKITEM(13) | 0x00000000) | ||
359 | #define DIDmsg_dot11req_join_operationalrate4 \ | ||
360 | (P80211DID_MKSECTION(1) | \ | ||
361 | P80211DID_MKGROUP(6) | \ | ||
362 | P80211DID_MKITEM(14) | 0x00000000) | ||
363 | #define DIDmsg_dot11req_join_operationalrate5 \ | ||
364 | (P80211DID_MKSECTION(1) | \ | ||
365 | P80211DID_MKGROUP(6) | \ | ||
366 | P80211DID_MKITEM(15) | 0x00000000) | ||
367 | #define DIDmsg_dot11req_join_operationalrate6 \ | ||
368 | (P80211DID_MKSECTION(1) | \ | ||
369 | P80211DID_MKGROUP(6) | \ | ||
370 | P80211DID_MKITEM(16) | 0x00000000) | ||
371 | #define DIDmsg_dot11req_join_operationalrate7 \ | ||
372 | (P80211DID_MKSECTION(1) | \ | ||
373 | P80211DID_MKGROUP(6) | \ | ||
374 | P80211DID_MKITEM(17) | 0x00000000) | ||
375 | #define DIDmsg_dot11req_join_operationalrate8 \ | ||
376 | (P80211DID_MKSECTION(1) | \ | ||
377 | P80211DID_MKGROUP(6) | \ | ||
378 | P80211DID_MKITEM(18) | 0x00000000) | ||
379 | #define DIDmsg_dot11req_join_resultcode \ | ||
380 | (P80211DID_MKSECTION(1) | \ | ||
381 | P80211DID_MKGROUP(6) | \ | ||
382 | P80211DID_MKITEM(19) | 0x00000000) | ||
383 | #define DIDmsg_dot11req_authenticate \ | ||
384 | (P80211DID_MKSECTION(1) | \ | ||
385 | P80211DID_MKGROUP(7)) | ||
386 | #define DIDmsg_dot11req_authenticate_peerstaaddress \ | ||
387 | (P80211DID_MKSECTION(1) | \ | ||
388 | P80211DID_MKGROUP(7) | \ | ||
389 | P80211DID_MKITEM(1) | 0x00000000) | ||
390 | #define DIDmsg_dot11req_authenticate_authenticationtype \ | ||
391 | (P80211DID_MKSECTION(1) | \ | ||
392 | P80211DID_MKGROUP(7) | \ | ||
393 | P80211DID_MKITEM(2) | 0x00000000) | ||
394 | #define DIDmsg_dot11req_authenticate_authenticationfailuretimeout \ | ||
395 | (P80211DID_MKSECTION(1) | \ | ||
396 | P80211DID_MKGROUP(7) | \ | ||
397 | P80211DID_MKITEM(3) | 0x00000000) | ||
398 | #define DIDmsg_dot11req_authenticate_resultcode \ | ||
399 | (P80211DID_MKSECTION(1) | \ | ||
400 | P80211DID_MKGROUP(7) | \ | ||
401 | P80211DID_MKITEM(4) | 0x00000000) | ||
402 | #define DIDmsg_dot11req_deauthenticate \ | ||
403 | (P80211DID_MKSECTION(1) | \ | ||
404 | P80211DID_MKGROUP(8)) | ||
405 | #define DIDmsg_dot11req_deauthenticate_peerstaaddress \ | ||
406 | (P80211DID_MKSECTION(1) | \ | ||
407 | P80211DID_MKGROUP(8) | \ | ||
408 | P80211DID_MKITEM(1) | 0x00000000) | ||
409 | #define DIDmsg_dot11req_deauthenticate_reasoncode \ | ||
410 | (P80211DID_MKSECTION(1) | \ | ||
411 | P80211DID_MKGROUP(8) | \ | ||
412 | P80211DID_MKITEM(2) | 0x00000000) | ||
413 | #define DIDmsg_dot11req_deauthenticate_resultcode \ | ||
414 | (P80211DID_MKSECTION(1) | \ | ||
415 | P80211DID_MKGROUP(8) | \ | ||
416 | P80211DID_MKITEM(3) | 0x00000000) | ||
417 | #define DIDmsg_dot11req_associate \ | ||
418 | (P80211DID_MKSECTION(1) | \ | ||
419 | P80211DID_MKGROUP(9)) | ||
420 | #define DIDmsg_dot11req_associate_peerstaaddress \ | ||
421 | (P80211DID_MKSECTION(1) | \ | ||
422 | P80211DID_MKGROUP(9) | \ | ||
423 | P80211DID_MKITEM(1) | 0x00000000) | ||
424 | #define DIDmsg_dot11req_associate_associatefailuretimeout \ | ||
425 | (P80211DID_MKSECTION(1) | \ | ||
426 | P80211DID_MKGROUP(9) | \ | ||
427 | P80211DID_MKITEM(2) | 0x00000000) | ||
428 | #define DIDmsg_dot11req_associate_cfpollable \ | ||
429 | (P80211DID_MKSECTION(1) | \ | ||
430 | P80211DID_MKGROUP(9) | \ | ||
431 | P80211DID_MKITEM(3) | 0x00000000) | ||
432 | #define DIDmsg_dot11req_associate_cfpollreq \ | ||
433 | (P80211DID_MKSECTION(1) | \ | ||
434 | P80211DID_MKGROUP(9) | \ | ||
435 | P80211DID_MKITEM(4) | 0x00000000) | ||
436 | #define DIDmsg_dot11req_associate_privacy \ | ||
437 | (P80211DID_MKSECTION(1) | \ | ||
438 | P80211DID_MKGROUP(9) | \ | ||
439 | P80211DID_MKITEM(5) | 0x00000000) | ||
440 | #define DIDmsg_dot11req_associate_listeninterval \ | ||
441 | (P80211DID_MKSECTION(1) | \ | ||
442 | P80211DID_MKGROUP(9) | \ | ||
443 | P80211DID_MKITEM(6) | 0x00000000) | ||
444 | #define DIDmsg_dot11req_associate_resultcode \ | ||
445 | (P80211DID_MKSECTION(1) | \ | ||
446 | P80211DID_MKGROUP(9) | \ | ||
447 | P80211DID_MKITEM(7) | 0x00000000) | ||
448 | #define DIDmsg_dot11req_reassociate \ | ||
449 | (P80211DID_MKSECTION(1) | \ | ||
450 | P80211DID_MKGROUP(10)) | ||
451 | #define DIDmsg_dot11req_reassociate_newapaddress \ | ||
452 | (P80211DID_MKSECTION(1) | \ | ||
453 | P80211DID_MKGROUP(10) | \ | ||
454 | P80211DID_MKITEM(1) | 0x00000000) | ||
455 | #define DIDmsg_dot11req_reassociate_reassociatefailuretimeout \ | ||
456 | (P80211DID_MKSECTION(1) | \ | ||
457 | P80211DID_MKGROUP(10) | \ | ||
458 | P80211DID_MKITEM(2) | 0x00000000) | ||
459 | #define DIDmsg_dot11req_reassociate_cfpollable \ | ||
460 | (P80211DID_MKSECTION(1) | \ | ||
461 | P80211DID_MKGROUP(10) | \ | ||
462 | P80211DID_MKITEM(3) | 0x00000000) | ||
463 | #define DIDmsg_dot11req_reassociate_cfpollreq \ | ||
464 | (P80211DID_MKSECTION(1) | \ | ||
465 | P80211DID_MKGROUP(10) | \ | ||
466 | P80211DID_MKITEM(4) | 0x00000000) | ||
467 | #define DIDmsg_dot11req_reassociate_privacy \ | ||
468 | (P80211DID_MKSECTION(1) | \ | ||
469 | P80211DID_MKGROUP(10) | \ | ||
470 | P80211DID_MKITEM(5) | 0x00000000) | ||
471 | #define DIDmsg_dot11req_reassociate_listeninterval \ | ||
472 | (P80211DID_MKSECTION(1) | \ | ||
473 | P80211DID_MKGROUP(10) | \ | ||
474 | P80211DID_MKITEM(6) | 0x00000000) | ||
475 | #define DIDmsg_dot11req_reassociate_resultcode \ | ||
476 | (P80211DID_MKSECTION(1) | \ | ||
477 | P80211DID_MKGROUP(10) | \ | ||
478 | P80211DID_MKITEM(7) | 0x00000000) | ||
479 | #define DIDmsg_dot11req_disassociate \ | ||
480 | (P80211DID_MKSECTION(1) | \ | ||
481 | P80211DID_MKGROUP(11)) | ||
482 | #define DIDmsg_dot11req_disassociate_peerstaaddress \ | ||
483 | (P80211DID_MKSECTION(1) | \ | ||
484 | P80211DID_MKGROUP(11) | \ | ||
485 | P80211DID_MKITEM(1) | 0x00000000) | ||
486 | #define DIDmsg_dot11req_disassociate_reasoncode \ | ||
487 | (P80211DID_MKSECTION(1) | \ | ||
488 | P80211DID_MKGROUP(11) | \ | ||
489 | P80211DID_MKITEM(2) | 0x00000000) | ||
490 | #define DIDmsg_dot11req_disassociate_resultcode \ | ||
491 | (P80211DID_MKSECTION(1) | \ | ||
492 | P80211DID_MKGROUP(11) | \ | ||
493 | P80211DID_MKITEM(3) | 0x00000000) | ||
494 | #define DIDmsg_dot11req_reset \ | ||
495 | (P80211DID_MKSECTION(1) | \ | ||
496 | P80211DID_MKGROUP(12)) | ||
497 | #define DIDmsg_dot11req_reset_setdefaultmib \ | ||
498 | (P80211DID_MKSECTION(1) | \ | ||
499 | P80211DID_MKGROUP(12) | \ | ||
500 | P80211DID_MKITEM(1) | 0x00000000) | ||
501 | #define DIDmsg_dot11req_reset_macaddress \ | ||
502 | (P80211DID_MKSECTION(1) | \ | ||
503 | P80211DID_MKGROUP(12) | \ | ||
504 | P80211DID_MKITEM(2) | 0x00000000) | ||
505 | #define DIDmsg_dot11req_reset_resultcode \ | ||
506 | (P80211DID_MKSECTION(1) | \ | ||
507 | P80211DID_MKGROUP(12) | \ | ||
508 | P80211DID_MKITEM(3) | 0x00000000) | ||
509 | #define DIDmsg_dot11req_start \ | ||
510 | (P80211DID_MKSECTION(1) | \ | ||
511 | P80211DID_MKGROUP(13)) | ||
512 | #define DIDmsg_dot11req_start_ssid \ | ||
513 | (P80211DID_MKSECTION(1) | \ | ||
514 | P80211DID_MKGROUP(13) | \ | ||
515 | P80211DID_MKITEM(1) | 0x00000000) | ||
516 | #define DIDmsg_dot11req_start_bsstype \ | ||
517 | (P80211DID_MKSECTION(1) | \ | ||
518 | P80211DID_MKGROUP(13) | \ | ||
519 | P80211DID_MKITEM(2) | 0x00000000) | ||
520 | #define DIDmsg_dot11req_start_beaconperiod \ | ||
521 | (P80211DID_MKSECTION(1) | \ | ||
522 | P80211DID_MKGROUP(13) | \ | ||
523 | P80211DID_MKITEM(3) | 0x00000000) | ||
524 | #define DIDmsg_dot11req_start_dtimperiod \ | ||
525 | (P80211DID_MKSECTION(1) | \ | ||
526 | P80211DID_MKGROUP(13) | \ | ||
527 | P80211DID_MKITEM(4) | 0x00000000) | ||
528 | #define DIDmsg_dot11req_start_cfpperiod \ | ||
529 | (P80211DID_MKSECTION(1) | \ | ||
530 | P80211DID_MKGROUP(13) | \ | ||
531 | P80211DID_MKITEM(5) | 0x00000000) | ||
532 | #define DIDmsg_dot11req_start_cfpmaxduration \ | ||
533 | (P80211DID_MKSECTION(1) | \ | ||
534 | P80211DID_MKGROUP(13) | \ | ||
535 | P80211DID_MKITEM(6) | 0x00000000) | ||
536 | #define DIDmsg_dot11req_start_fhdwelltime \ | ||
537 | (P80211DID_MKSECTION(1) | \ | ||
538 | P80211DID_MKGROUP(13) | \ | ||
539 | P80211DID_MKITEM(7) | 0x00000000) | ||
540 | #define DIDmsg_dot11req_start_fhhopset \ | ||
541 | (P80211DID_MKSECTION(1) | \ | ||
542 | P80211DID_MKGROUP(13) | \ | ||
543 | P80211DID_MKITEM(8) | 0x00000000) | ||
544 | #define DIDmsg_dot11req_start_fhhoppattern \ | ||
545 | (P80211DID_MKSECTION(1) | \ | ||
546 | P80211DID_MKGROUP(13) | \ | ||
547 | P80211DID_MKITEM(9) | 0x00000000) | ||
548 | #define DIDmsg_dot11req_start_dschannel \ | ||
549 | (P80211DID_MKSECTION(1) | \ | ||
550 | P80211DID_MKGROUP(13) | \ | ||
551 | P80211DID_MKITEM(10) | 0x00000000) | ||
552 | #define DIDmsg_dot11req_start_ibssatimwindow \ | ||
553 | (P80211DID_MKSECTION(1) | \ | ||
554 | P80211DID_MKGROUP(13) | \ | ||
555 | P80211DID_MKITEM(11) | 0x00000000) | ||
556 | #define DIDmsg_dot11req_start_probedelay \ | ||
557 | (P80211DID_MKSECTION(1) | \ | ||
558 | P80211DID_MKGROUP(13) | \ | ||
559 | P80211DID_MKITEM(12) | 0x00000000) | ||
560 | #define DIDmsg_dot11req_start_cfpollable \ | ||
561 | (P80211DID_MKSECTION(1) | \ | ||
562 | P80211DID_MKGROUP(13) | \ | ||
563 | P80211DID_MKITEM(13) | 0x00000000) | ||
564 | #define DIDmsg_dot11req_start_cfpollreq \ | ||
565 | (P80211DID_MKSECTION(1) | \ | ||
566 | P80211DID_MKGROUP(13) | \ | ||
567 | P80211DID_MKITEM(14) | 0x00000000) | ||
568 | #define DIDmsg_dot11req_start_basicrate1 \ | ||
569 | (P80211DID_MKSECTION(1) | \ | ||
570 | P80211DID_MKGROUP(13) | \ | ||
571 | P80211DID_MKITEM(15) | 0x00000000) | ||
572 | #define DIDmsg_dot11req_start_basicrate2 \ | ||
573 | (P80211DID_MKSECTION(1) | \ | ||
574 | P80211DID_MKGROUP(13) | \ | ||
575 | P80211DID_MKITEM(16) | 0x00000000) | ||
576 | #define DIDmsg_dot11req_start_basicrate3 \ | ||
577 | (P80211DID_MKSECTION(1) | \ | ||
578 | P80211DID_MKGROUP(13) | \ | ||
579 | P80211DID_MKITEM(17) | 0x00000000) | ||
580 | #define DIDmsg_dot11req_start_basicrate4 \ | ||
581 | (P80211DID_MKSECTION(1) | \ | ||
582 | P80211DID_MKGROUP(13) | \ | ||
583 | P80211DID_MKITEM(18) | 0x00000000) | ||
584 | #define DIDmsg_dot11req_start_basicrate5 \ | ||
585 | (P80211DID_MKSECTION(1) | \ | ||
586 | P80211DID_MKGROUP(13) | \ | ||
587 | P80211DID_MKITEM(19) | 0x00000000) | ||
588 | #define DIDmsg_dot11req_start_basicrate6 \ | ||
589 | (P80211DID_MKSECTION(1) | \ | ||
590 | P80211DID_MKGROUP(13) | \ | ||
591 | P80211DID_MKITEM(20) | 0x00000000) | ||
592 | #define DIDmsg_dot11req_start_basicrate7 \ | ||
593 | (P80211DID_MKSECTION(1) | \ | ||
594 | P80211DID_MKGROUP(13) | \ | ||
595 | P80211DID_MKITEM(21) | 0x00000000) | ||
596 | #define DIDmsg_dot11req_start_basicrate8 \ | ||
597 | (P80211DID_MKSECTION(1) | \ | ||
598 | P80211DID_MKGROUP(13) | \ | ||
599 | P80211DID_MKITEM(22) | 0x00000000) | ||
600 | #define DIDmsg_dot11req_start_operationalrate1 \ | ||
601 | (P80211DID_MKSECTION(1) | \ | ||
602 | P80211DID_MKGROUP(13) | \ | ||
603 | P80211DID_MKITEM(23) | 0x00000000) | ||
604 | #define DIDmsg_dot11req_start_operationalrate2 \ | ||
605 | (P80211DID_MKSECTION(1) | \ | ||
606 | P80211DID_MKGROUP(13) | \ | ||
607 | P80211DID_MKITEM(24) | 0x00000000) | ||
608 | #define DIDmsg_dot11req_start_operationalrate3 \ | ||
609 | (P80211DID_MKSECTION(1) | \ | ||
610 | P80211DID_MKGROUP(13) | \ | ||
611 | P80211DID_MKITEM(25) | 0x00000000) | ||
612 | #define DIDmsg_dot11req_start_operationalrate4 \ | ||
613 | (P80211DID_MKSECTION(1) | \ | ||
614 | P80211DID_MKGROUP(13) | \ | ||
615 | P80211DID_MKITEM(26) | 0x00000000) | ||
616 | #define DIDmsg_dot11req_start_operationalrate5 \ | ||
617 | (P80211DID_MKSECTION(1) | \ | ||
618 | P80211DID_MKGROUP(13) | \ | ||
619 | P80211DID_MKITEM(27) | 0x00000000) | ||
620 | #define DIDmsg_dot11req_start_operationalrate6 \ | ||
621 | (P80211DID_MKSECTION(1) | \ | ||
622 | P80211DID_MKGROUP(13) | \ | ||
623 | P80211DID_MKITEM(28) | 0x00000000) | ||
624 | #define DIDmsg_dot11req_start_operationalrate7 \ | ||
625 | (P80211DID_MKSECTION(1) | \ | ||
626 | P80211DID_MKGROUP(13) | \ | ||
627 | P80211DID_MKITEM(29) | 0x00000000) | ||
628 | #define DIDmsg_dot11req_start_operationalrate8 \ | ||
629 | (P80211DID_MKSECTION(1) | \ | ||
630 | P80211DID_MKGROUP(13) | \ | ||
631 | P80211DID_MKITEM(30) | 0x00000000) | ||
632 | #define DIDmsg_dot11req_start_resultcode \ | ||
633 | (P80211DID_MKSECTION(1) | \ | ||
634 | P80211DID_MKGROUP(13) | \ | ||
635 | P80211DID_MKITEM(31) | 0x00000000) | ||
636 | #define DIDmsg_cat_dot11ind \ | ||
637 | P80211DID_MKSECTION(2) | ||
638 | #define DIDmsg_dot11ind_authenticate \ | ||
639 | (P80211DID_MKSECTION(2) | \ | ||
640 | P80211DID_MKGROUP(1)) | ||
641 | #define DIDmsg_dot11ind_authenticate_peerstaaddress \ | ||
642 | (P80211DID_MKSECTION(2) | \ | ||
643 | P80211DID_MKGROUP(1) | \ | ||
644 | P80211DID_MKITEM(1) | 0x00000000) | ||
645 | #define DIDmsg_dot11ind_authenticate_authenticationtype \ | ||
646 | (P80211DID_MKSECTION(2) | \ | ||
647 | P80211DID_MKGROUP(1) | \ | ||
648 | P80211DID_MKITEM(2) | 0x00000000) | ||
649 | #define DIDmsg_dot11ind_deauthenticate \ | ||
650 | (P80211DID_MKSECTION(2) | \ | ||
651 | P80211DID_MKGROUP(2)) | ||
652 | #define DIDmsg_dot11ind_deauthenticate_peerstaaddress \ | ||
653 | (P80211DID_MKSECTION(2) | \ | ||
654 | P80211DID_MKGROUP(2) | \ | ||
655 | P80211DID_MKITEM(1) | 0x00000000) | ||
656 | #define DIDmsg_dot11ind_deauthenticate_reasoncode \ | ||
657 | (P80211DID_MKSECTION(2) | \ | ||
658 | P80211DID_MKGROUP(2) | \ | ||
659 | P80211DID_MKITEM(2) | 0x00000000) | ||
660 | #define DIDmsg_dot11ind_associate \ | ||
661 | (P80211DID_MKSECTION(2) | \ | ||
662 | P80211DID_MKGROUP(3)) | ||
663 | #define DIDmsg_dot11ind_associate_peerstaaddress \ | ||
664 | (P80211DID_MKSECTION(2) | \ | ||
665 | P80211DID_MKGROUP(3) | \ | ||
666 | P80211DID_MKITEM(1) | 0x00000000) | ||
667 | #define DIDmsg_dot11ind_associate_aid \ | ||
668 | (P80211DID_MKSECTION(2) | \ | ||
669 | P80211DID_MKGROUP(3) | \ | ||
670 | P80211DID_MKITEM(2) | 0x00000000) | ||
671 | #define DIDmsg_dot11ind_reassociate \ | ||
672 | (P80211DID_MKSECTION(2) | \ | ||
673 | P80211DID_MKGROUP(4)) | ||
674 | #define DIDmsg_dot11ind_reassociate_peerstaaddress \ | ||
675 | (P80211DID_MKSECTION(2) | \ | ||
676 | P80211DID_MKGROUP(4) | \ | ||
677 | P80211DID_MKITEM(1) | 0x00000000) | ||
678 | #define DIDmsg_dot11ind_reassociate_aid \ | ||
679 | (P80211DID_MKSECTION(2) | \ | ||
680 | P80211DID_MKGROUP(4) | \ | ||
681 | P80211DID_MKITEM(2) | 0x00000000) | ||
682 | #define DIDmsg_dot11ind_reassociate_oldapaddress \ | ||
683 | (P80211DID_MKSECTION(2) | \ | ||
684 | P80211DID_MKGROUP(4) | \ | ||
685 | P80211DID_MKITEM(3) | 0x00000000) | ||
686 | #define DIDmsg_dot11ind_disassociate \ | ||
687 | (P80211DID_MKSECTION(2) | \ | ||
688 | P80211DID_MKGROUP(5)) | ||
689 | #define DIDmsg_dot11ind_disassociate_peerstaaddress \ | ||
690 | (P80211DID_MKSECTION(2) | \ | ||
691 | P80211DID_MKGROUP(5) | \ | ||
692 | P80211DID_MKITEM(1) | 0x00000000) | ||
693 | #define DIDmsg_dot11ind_disassociate_reasoncode \ | ||
694 | (P80211DID_MKSECTION(2) | \ | ||
695 | P80211DID_MKGROUP(5) | \ | ||
696 | P80211DID_MKITEM(2) | 0x00000000) | ||
697 | #define DIDmsg_cat_lnxreq \ | ||
698 | P80211DID_MKSECTION(3) | ||
699 | #define DIDmsg_lnxreq_ifstate \ | ||
700 | (P80211DID_MKSECTION(3) | \ | ||
701 | P80211DID_MKGROUP(1)) | ||
702 | #define DIDmsg_lnxreq_ifstate_ifstate \ | ||
703 | (P80211DID_MKSECTION(3) | \ | ||
704 | P80211DID_MKGROUP(1) | \ | ||
705 | P80211DID_MKITEM(1) | 0x00000000) | ||
706 | #define DIDmsg_lnxreq_ifstate_resultcode \ | ||
707 | (P80211DID_MKSECTION(3) | \ | ||
708 | P80211DID_MKGROUP(1) | \ | ||
709 | P80211DID_MKITEM(2) | 0x00000000) | ||
710 | #define DIDmsg_lnxreq_wlansniff \ | ||
711 | (P80211DID_MKSECTION(3) | \ | ||
712 | P80211DID_MKGROUP(2)) | ||
713 | #define DIDmsg_lnxreq_wlansniff_enable \ | ||
714 | (P80211DID_MKSECTION(3) | \ | ||
715 | P80211DID_MKGROUP(2) | \ | ||
716 | P80211DID_MKITEM(1) | 0x00000000) | ||
717 | #define DIDmsg_lnxreq_wlansniff_channel \ | ||
718 | (P80211DID_MKSECTION(3) | \ | ||
719 | P80211DID_MKGROUP(2) | \ | ||
720 | P80211DID_MKITEM(2) | 0x00000000) | ||
721 | #define DIDmsg_lnxreq_wlansniff_prismheader \ | ||
722 | (P80211DID_MKSECTION(3) | \ | ||
723 | P80211DID_MKGROUP(2) | \ | ||
724 | P80211DID_MKITEM(3) | 0x00000000) | ||
725 | #define DIDmsg_lnxreq_wlansniff_wlanheader \ | ||
726 | (P80211DID_MKSECTION(3) | \ | ||
727 | P80211DID_MKGROUP(2) | \ | ||
728 | P80211DID_MKITEM(4) | 0x00000000) | ||
729 | #define DIDmsg_lnxreq_wlansniff_keepwepflags \ | ||
730 | (P80211DID_MKSECTION(3) | \ | ||
731 | P80211DID_MKGROUP(2) | \ | ||
732 | P80211DID_MKITEM(5) | 0x00000000) | ||
733 | #define DIDmsg_lnxreq_wlansniff_stripfcs \ | ||
734 | (P80211DID_MKSECTION(3) | \ | ||
735 | P80211DID_MKGROUP(2) | \ | ||
736 | P80211DID_MKITEM(6) | 0x00000000) | ||
737 | #define DIDmsg_lnxreq_wlansniff_packet_trunc \ | ||
738 | (P80211DID_MKSECTION(3) | \ | ||
739 | P80211DID_MKGROUP(2) | \ | ||
740 | P80211DID_MKITEM(7) | 0x00000000) | ||
741 | #define DIDmsg_lnxreq_wlansniff_resultcode \ | ||
742 | (P80211DID_MKSECTION(3) | \ | ||
743 | P80211DID_MKGROUP(2) | \ | ||
744 | P80211DID_MKITEM(8) | 0x00000000) | ||
745 | #define DIDmsg_lnxreq_hostwep \ | ||
746 | (P80211DID_MKSECTION(3) | \ | ||
747 | P80211DID_MKGROUP(3)) | ||
748 | #define DIDmsg_lnxreq_hostwep_resultcode \ | ||
749 | (P80211DID_MKSECTION(3) | \ | ||
750 | P80211DID_MKGROUP(3) | \ | ||
751 | P80211DID_MKITEM(1) | 0x00000000) | ||
752 | #define DIDmsg_lnxreq_hostwep_decrypt \ | ||
753 | (P80211DID_MKSECTION(3) | \ | ||
754 | P80211DID_MKGROUP(3) | \ | ||
755 | P80211DID_MKITEM(2) | 0x00000000) | ||
756 | #define DIDmsg_lnxreq_hostwep_encrypt \ | ||
757 | (P80211DID_MKSECTION(3) | \ | ||
758 | P80211DID_MKGROUP(3) | \ | ||
759 | P80211DID_MKITEM(3) | 0x00000000) | ||
760 | #define DIDmsg_lnxreq_commsquality \ | ||
761 | (P80211DID_MKSECTION(3) | \ | ||
762 | P80211DID_MKGROUP(4)) | ||
763 | #define DIDmsg_lnxreq_commsquality_resultcode \ | ||
764 | (P80211DID_MKSECTION(3) | \ | ||
765 | P80211DID_MKGROUP(4) | \ | ||
766 | P80211DID_MKITEM(1) | 0x00000000) | ||
767 | #define DIDmsg_lnxreq_commsquality_dbm \ | ||
768 | (P80211DID_MKSECTION(3) | \ | ||
769 | P80211DID_MKGROUP(4) | \ | ||
770 | P80211DID_MKITEM(2) | 0x00000000) | ||
771 | #define DIDmsg_lnxreq_commsquality_link \ | ||
772 | (P80211DID_MKSECTION(3) | \ | ||
773 | P80211DID_MKGROUP(4) | \ | ||
774 | P80211DID_MKITEM(3) | 0x00000000) | ||
775 | #define DIDmsg_lnxreq_commsquality_level \ | ||
776 | (P80211DID_MKSECTION(3) | \ | ||
777 | P80211DID_MKGROUP(4) | \ | ||
778 | P80211DID_MKITEM(4) | 0x00000000) | ||
779 | #define DIDmsg_lnxreq_commsquality_noise \ | ||
780 | (P80211DID_MKSECTION(3) | \ | ||
781 | P80211DID_MKGROUP(4) | \ | ||
782 | P80211DID_MKITEM(5) | 0x00000000) | ||
783 | #define DIDmsg_lnxreq_autojoin \ | ||
784 | (P80211DID_MKSECTION(3) | \ | ||
785 | P80211DID_MKGROUP(5)) | ||
786 | #define DIDmsg_lnxreq_autojoin_ssid \ | ||
787 | (P80211DID_MKSECTION(3) | \ | ||
788 | P80211DID_MKGROUP(5) | \ | ||
789 | P80211DID_MKITEM(1) | 0x00000000) | ||
790 | #define DIDmsg_lnxreq_autojoin_authtype \ | ||
791 | (P80211DID_MKSECTION(3) | \ | ||
792 | P80211DID_MKGROUP(5) | \ | ||
793 | P80211DID_MKITEM(2) | 0x00000000) | ||
794 | #define DIDmsg_lnxreq_autojoin_resultcode \ | ||
795 | (P80211DID_MKSECTION(3) | \ | ||
796 | P80211DID_MKGROUP(5) | \ | ||
797 | P80211DID_MKITEM(3) | 0x00000000) | ||
798 | #define DIDmsg_cat_lnxind \ | ||
799 | P80211DID_MKSECTION(4) | ||
800 | #define DIDmsg_lnxind_wlansniffrm \ | ||
801 | (P80211DID_MKSECTION(4) | \ | ||
802 | P80211DID_MKGROUP(1)) | ||
803 | #define DIDmsg_lnxind_wlansniffrm_hosttime \ | ||
804 | (P80211DID_MKSECTION(4) | \ | ||
805 | P80211DID_MKGROUP(1) | \ | ||
806 | P80211DID_MKITEM(1) | 0x00000000) | ||
807 | #define DIDmsg_lnxind_wlansniffrm_mactime \ | ||
808 | (P80211DID_MKSECTION(4) | \ | ||
809 | P80211DID_MKGROUP(1) | \ | ||
810 | P80211DID_MKITEM(2) | 0x00000000) | ||
811 | #define DIDmsg_lnxind_wlansniffrm_channel \ | ||
812 | (P80211DID_MKSECTION(4) | \ | ||
813 | P80211DID_MKGROUP(1) | \ | ||
814 | P80211DID_MKITEM(3) | 0x00000000) | ||
815 | #define DIDmsg_lnxind_wlansniffrm_rssi \ | ||
816 | (P80211DID_MKSECTION(4) | \ | ||
817 | P80211DID_MKGROUP(1) | \ | ||
818 | P80211DID_MKITEM(4) | 0x00000000) | ||
819 | #define DIDmsg_lnxind_wlansniffrm_sq \ | ||
820 | (P80211DID_MKSECTION(4) | \ | ||
821 | P80211DID_MKGROUP(1) | \ | ||
822 | P80211DID_MKITEM(5) | 0x00000000) | ||
823 | #define DIDmsg_lnxind_wlansniffrm_signal \ | ||
824 | (P80211DID_MKSECTION(4) | \ | ||
825 | P80211DID_MKGROUP(1) | \ | ||
826 | P80211DID_MKITEM(6) | 0x00000000) | ||
827 | #define DIDmsg_lnxind_wlansniffrm_noise \ | ||
828 | (P80211DID_MKSECTION(4) | \ | ||
829 | P80211DID_MKGROUP(1) | \ | ||
830 | P80211DID_MKITEM(7) | 0x00000000) | ||
831 | #define DIDmsg_lnxind_wlansniffrm_rate \ | ||
832 | (P80211DID_MKSECTION(4) | \ | ||
833 | P80211DID_MKGROUP(1) | \ | ||
834 | P80211DID_MKITEM(8) | 0x00000000) | ||
835 | #define DIDmsg_lnxind_wlansniffrm_istx \ | ||
836 | (P80211DID_MKSECTION(4) | \ | ||
837 | P80211DID_MKGROUP(1) | \ | ||
838 | P80211DID_MKITEM(9) | 0x00000000) | ||
839 | #define DIDmsg_lnxind_wlansniffrm_frmlen \ | ||
840 | (P80211DID_MKSECTION(4) | \ | ||
841 | P80211DID_MKGROUP(1) | \ | ||
842 | P80211DID_MKITEM(10) | 0x00000000) | ||
843 | #define DIDmsg_lnxind_roam \ | ||
844 | (P80211DID_MKSECTION(4) | \ | ||
845 | P80211DID_MKGROUP(2)) | ||
846 | #define DIDmsg_lnxind_roam_reason \ | ||
847 | (P80211DID_MKSECTION(4) | \ | ||
848 | P80211DID_MKGROUP(2) | \ | ||
849 | P80211DID_MKITEM(1) | 0x00000000) | ||
850 | #define DIDmsg_cat_p2req \ | ||
851 | P80211DID_MKSECTION(5) | ||
852 | #define DIDmsg_p2req_join \ | ||
853 | (P80211DID_MKSECTION(5) | \ | ||
854 | P80211DID_MKGROUP(1)) | ||
855 | #define DIDmsg_p2req_join_bssid \ | ||
856 | (P80211DID_MKSECTION(5) | \ | ||
857 | P80211DID_MKGROUP(1) | \ | ||
858 | P80211DID_MKITEM(1) | 0x00000000) | ||
859 | #define DIDmsg_p2req_join_basicrate1 \ | ||
860 | (P80211DID_MKSECTION(5) | \ | ||
861 | P80211DID_MKGROUP(1) | \ | ||
862 | P80211DID_MKITEM(2) | 0x00000000) | ||
863 | #define DIDmsg_p2req_join_basicrate2 \ | ||
864 | (P80211DID_MKSECTION(5) | \ | ||
865 | P80211DID_MKGROUP(1) | \ | ||
866 | P80211DID_MKITEM(3) | 0x00000000) | ||
867 | #define DIDmsg_p2req_join_basicrate3 \ | ||
868 | (P80211DID_MKSECTION(5) | \ | ||
869 | P80211DID_MKGROUP(1) | \ | ||
870 | P80211DID_MKITEM(4) | 0x00000000) | ||
871 | #define DIDmsg_p2req_join_basicrate4 \ | ||
872 | (P80211DID_MKSECTION(5) | \ | ||
873 | P80211DID_MKGROUP(1) | \ | ||
874 | P80211DID_MKITEM(5) | 0x00000000) | ||
875 | #define DIDmsg_p2req_join_basicrate5 \ | ||
876 | (P80211DID_MKSECTION(5) | \ | ||
877 | P80211DID_MKGROUP(1) | \ | ||
878 | P80211DID_MKITEM(6) | 0x00000000) | ||
879 | #define DIDmsg_p2req_join_basicrate6 \ | ||
880 | (P80211DID_MKSECTION(5) | \ | ||
881 | P80211DID_MKGROUP(1) | \ | ||
882 | P80211DID_MKITEM(7) | 0x00000000) | ||
883 | #define DIDmsg_p2req_join_basicrate7 \ | ||
884 | (P80211DID_MKSECTION(5) | \ | ||
885 | P80211DID_MKGROUP(1) | \ | ||
886 | P80211DID_MKITEM(8) | 0x00000000) | ||
887 | #define DIDmsg_p2req_join_basicrate8 \ | ||
888 | (P80211DID_MKSECTION(5) | \ | ||
889 | P80211DID_MKGROUP(1) | \ | ||
890 | P80211DID_MKITEM(9) | 0x00000000) | ||
891 | #define DIDmsg_p2req_join_operationalrate1 \ | ||
892 | (P80211DID_MKSECTION(5) | \ | ||
893 | P80211DID_MKGROUP(1) | \ | ||
894 | P80211DID_MKITEM(10) | 0x00000000) | ||
895 | #define DIDmsg_p2req_join_operationalrate2 \ | ||
896 | (P80211DID_MKSECTION(5) | \ | ||
897 | P80211DID_MKGROUP(1) | \ | ||
898 | P80211DID_MKITEM(11) | 0x00000000) | ||
899 | #define DIDmsg_p2req_join_operationalrate3 \ | ||
900 | (P80211DID_MKSECTION(5) | \ | ||
901 | P80211DID_MKGROUP(1) | \ | ||
902 | P80211DID_MKITEM(12) | 0x00000000) | ||
903 | #define DIDmsg_p2req_join_operationalrate4 \ | ||
904 | (P80211DID_MKSECTION(5) | \ | ||
905 | P80211DID_MKGROUP(1) | \ | ||
906 | P80211DID_MKITEM(13) | 0x00000000) | ||
907 | #define DIDmsg_p2req_join_operationalrate5 \ | ||
908 | (P80211DID_MKSECTION(5) | \ | ||
909 | P80211DID_MKGROUP(1) | \ | ||
910 | P80211DID_MKITEM(14) | 0x00000000) | ||
911 | #define DIDmsg_p2req_join_operationalrate6 \ | ||
912 | (P80211DID_MKSECTION(5) | \ | ||
913 | P80211DID_MKGROUP(1) | \ | ||
914 | P80211DID_MKITEM(15) | 0x00000000) | ||
915 | #define DIDmsg_p2req_join_operationalrate7 \ | ||
916 | (P80211DID_MKSECTION(5) | \ | ||
917 | P80211DID_MKGROUP(1) | \ | ||
918 | P80211DID_MKITEM(16) | 0x00000000) | ||
919 | #define DIDmsg_p2req_join_operationalrate8 \ | ||
920 | (P80211DID_MKSECTION(5) | \ | ||
921 | P80211DID_MKGROUP(1) | \ | ||
922 | P80211DID_MKITEM(17) | 0x00000000) | ||
923 | #define DIDmsg_p2req_join_ssid \ | ||
924 | (P80211DID_MKSECTION(5) | \ | ||
925 | P80211DID_MKGROUP(1) | \ | ||
926 | P80211DID_MKITEM(18) | 0x00000000) | ||
927 | #define DIDmsg_p2req_join_channel \ | ||
928 | (P80211DID_MKSECTION(5) | \ | ||
929 | P80211DID_MKGROUP(1) | \ | ||
930 | P80211DID_MKITEM(19) | 0x00000000) | ||
931 | #define DIDmsg_p2req_join_authtype \ | ||
932 | (P80211DID_MKSECTION(5) | \ | ||
933 | P80211DID_MKGROUP(1) | \ | ||
934 | P80211DID_MKITEM(20) | 0x00000000) | ||
935 | #define DIDmsg_p2req_join_resultcode \ | ||
936 | (P80211DID_MKSECTION(5) | \ | ||
937 | P80211DID_MKGROUP(1) | \ | ||
938 | P80211DID_MKITEM(21) | 0x00000000) | ||
939 | #define DIDmsg_p2req_readpda \ | ||
940 | (P80211DID_MKSECTION(5) | \ | ||
941 | P80211DID_MKGROUP(2)) | ||
942 | #define DIDmsg_p2req_readpda_pda \ | ||
943 | (P80211DID_MKSECTION(5) | \ | ||
944 | P80211DID_MKGROUP(2) | \ | ||
945 | P80211DID_MKITEM(1) | 0x00000000) | ||
946 | #define DIDmsg_p2req_readpda_resultcode \ | ||
947 | (P80211DID_MKSECTION(5) | \ | ||
948 | P80211DID_MKGROUP(2) | \ | ||
949 | P80211DID_MKITEM(2) | 0x00000000) | ||
950 | #define DIDmsg_p2req_readcis \ | ||
951 | (P80211DID_MKSECTION(5) | \ | ||
952 | P80211DID_MKGROUP(3)) | ||
953 | #define DIDmsg_p2req_readcis_cis \ | ||
954 | (P80211DID_MKSECTION(5) | \ | ||
955 | P80211DID_MKGROUP(3) | \ | ||
956 | P80211DID_MKITEM(1) | 0x00000000) | ||
957 | #define DIDmsg_p2req_readcis_resultcode \ | ||
958 | (P80211DID_MKSECTION(5) | \ | ||
959 | P80211DID_MKGROUP(3) | \ | ||
960 | P80211DID_MKITEM(2) | 0x00000000) | ||
961 | #define DIDmsg_p2req_auxport_state \ | ||
962 | (P80211DID_MKSECTION(5) | \ | ||
963 | P80211DID_MKGROUP(4)) | ||
964 | #define DIDmsg_p2req_auxport_state_enable \ | ||
965 | (P80211DID_MKSECTION(5) | \ | ||
966 | P80211DID_MKGROUP(4) | \ | ||
967 | P80211DID_MKITEM(1) | 0x00000000) | ||
968 | #define DIDmsg_p2req_auxport_state_resultcode \ | ||
969 | (P80211DID_MKSECTION(5) | \ | ||
970 | P80211DID_MKGROUP(4) | \ | ||
971 | P80211DID_MKITEM(2) | 0x00000000) | ||
972 | #define DIDmsg_p2req_auxport_read \ | ||
973 | (P80211DID_MKSECTION(5) | \ | ||
974 | P80211DID_MKGROUP(5)) | ||
975 | #define DIDmsg_p2req_auxport_read_addr \ | ||
976 | (P80211DID_MKSECTION(5) | \ | ||
977 | P80211DID_MKGROUP(5) | \ | ||
978 | P80211DID_MKITEM(1) | 0x00000000) | ||
979 | #define DIDmsg_p2req_auxport_read_len \ | ||
980 | (P80211DID_MKSECTION(5) | \ | ||
981 | P80211DID_MKGROUP(5) | \ | ||
982 | P80211DID_MKITEM(2) | 0x00000000) | ||
983 | #define DIDmsg_p2req_auxport_read_data \ | ||
984 | (P80211DID_MKSECTION(5) | \ | ||
985 | P80211DID_MKGROUP(5) | \ | ||
986 | P80211DID_MKITEM(3) | 0x00000000) | ||
987 | #define DIDmsg_p2req_auxport_read_resultcode \ | ||
988 | (P80211DID_MKSECTION(5) | \ | ||
989 | P80211DID_MKGROUP(5) | \ | ||
990 | P80211DID_MKITEM(4) | 0x00000000) | ||
991 | #define DIDmsg_p2req_auxport_write \ | ||
992 | (P80211DID_MKSECTION(5) | \ | ||
993 | P80211DID_MKGROUP(6)) | ||
994 | #define DIDmsg_p2req_auxport_write_addr \ | ||
995 | (P80211DID_MKSECTION(5) | \ | ||
996 | P80211DID_MKGROUP(6) | \ | ||
997 | P80211DID_MKITEM(1) | 0x00000000) | ||
998 | #define DIDmsg_p2req_auxport_write_len \ | ||
999 | (P80211DID_MKSECTION(5) | \ | ||
1000 | P80211DID_MKGROUP(6) | \ | ||
1001 | P80211DID_MKITEM(2) | 0x00000000) | ||
1002 | #define DIDmsg_p2req_auxport_write_data \ | ||
1003 | (P80211DID_MKSECTION(5) | \ | ||
1004 | P80211DID_MKGROUP(6) | \ | ||
1005 | P80211DID_MKITEM(3) | 0x00000000) | ||
1006 | #define DIDmsg_p2req_auxport_write_resultcode \ | ||
1007 | (P80211DID_MKSECTION(5) | \ | ||
1008 | P80211DID_MKGROUP(6) | \ | ||
1009 | P80211DID_MKITEM(4) | 0x00000000) | ||
1010 | #define DIDmsg_p2req_low_level \ | ||
1011 | (P80211DID_MKSECTION(5) | \ | ||
1012 | P80211DID_MKGROUP(7)) | ||
1013 | #define DIDmsg_p2req_low_level_command \ | ||
1014 | (P80211DID_MKSECTION(5) | \ | ||
1015 | P80211DID_MKGROUP(7) | \ | ||
1016 | P80211DID_MKITEM(1) | 0x00000000) | ||
1017 | #define DIDmsg_p2req_low_level_param0 \ | ||
1018 | (P80211DID_MKSECTION(5) | \ | ||
1019 | P80211DID_MKGROUP(7) | \ | ||
1020 | P80211DID_MKITEM(2) | 0x00000000) | ||
1021 | #define DIDmsg_p2req_low_level_param1 \ | ||
1022 | (P80211DID_MKSECTION(5) | \ | ||
1023 | P80211DID_MKGROUP(7) | \ | ||
1024 | P80211DID_MKITEM(3) | 0x00000000) | ||
1025 | #define DIDmsg_p2req_low_level_param2 \ | ||
1026 | (P80211DID_MKSECTION(5) | \ | ||
1027 | P80211DID_MKGROUP(7) | \ | ||
1028 | P80211DID_MKITEM(4) | 0x00000000) | ||
1029 | #define DIDmsg_p2req_low_level_resp0 \ | ||
1030 | (P80211DID_MKSECTION(5) | \ | ||
1031 | P80211DID_MKGROUP(7) | \ | ||
1032 | P80211DID_MKITEM(5) | 0x00000000) | ||
1033 | #define DIDmsg_p2req_low_level_resp1 \ | ||
1034 | (P80211DID_MKSECTION(5) | \ | ||
1035 | P80211DID_MKGROUP(7) | \ | ||
1036 | P80211DID_MKITEM(6) | 0x00000000) | ||
1037 | #define DIDmsg_p2req_low_level_resp2 \ | ||
1038 | (P80211DID_MKSECTION(5) | \ | ||
1039 | P80211DID_MKGROUP(7) | \ | ||
1040 | P80211DID_MKITEM(7) | 0x00000000) | ||
1041 | #define DIDmsg_p2req_low_level_resultcode \ | ||
1042 | (P80211DID_MKSECTION(5) | \ | ||
1043 | P80211DID_MKGROUP(7) | \ | ||
1044 | P80211DID_MKITEM(8) | 0x00000000) | ||
1045 | #define DIDmsg_p2req_test_command \ | ||
1046 | (P80211DID_MKSECTION(5) | \ | ||
1047 | P80211DID_MKGROUP(8)) | ||
1048 | #define DIDmsg_p2req_test_command_testcode \ | ||
1049 | (P80211DID_MKSECTION(5) | \ | ||
1050 | P80211DID_MKGROUP(8) | \ | ||
1051 | P80211DID_MKITEM(1) | 0x00000000) | ||
1052 | #define DIDmsg_p2req_test_command_testparam \ | ||
1053 | (P80211DID_MKSECTION(5) | \ | ||
1054 | P80211DID_MKGROUP(8) | \ | ||
1055 | P80211DID_MKITEM(2) | 0x00000000) | ||
1056 | #define DIDmsg_p2req_test_command_resultcode \ | ||
1057 | (P80211DID_MKSECTION(5) | \ | ||
1058 | P80211DID_MKGROUP(8) | \ | ||
1059 | P80211DID_MKITEM(3) | 0x00000000) | ||
1060 | #define DIDmsg_p2req_test_command_status \ | ||
1061 | (P80211DID_MKSECTION(5) | \ | ||
1062 | P80211DID_MKGROUP(8) | \ | ||
1063 | P80211DID_MKITEM(4) | 0x00000000) | ||
1064 | #define DIDmsg_p2req_test_command_resp0 \ | ||
1065 | (P80211DID_MKSECTION(5) | \ | ||
1066 | P80211DID_MKGROUP(8) | \ | ||
1067 | P80211DID_MKITEM(5) | 0x00000000) | ||
1068 | #define DIDmsg_p2req_test_command_resp1 \ | ||
1069 | (P80211DID_MKSECTION(5) | \ | ||
1070 | P80211DID_MKGROUP(8) | \ | ||
1071 | P80211DID_MKITEM(6) | 0x00000000) | ||
1072 | #define DIDmsg_p2req_test_command_resp2 \ | ||
1073 | (P80211DID_MKSECTION(5) | \ | ||
1074 | P80211DID_MKGROUP(8) | \ | ||
1075 | P80211DID_MKITEM(7) | 0x00000000) | ||
1076 | #define DIDmsg_p2req_mmi_read \ | ||
1077 | (P80211DID_MKSECTION(5) | \ | ||
1078 | P80211DID_MKGROUP(9)) | ||
1079 | #define DIDmsg_p2req_mmi_read_addr \ | ||
1080 | (P80211DID_MKSECTION(5) | \ | ||
1081 | P80211DID_MKGROUP(9) | \ | ||
1082 | P80211DID_MKITEM(1) | 0x00000000) | ||
1083 | #define DIDmsg_p2req_mmi_read_value \ | ||
1084 | (P80211DID_MKSECTION(5) | \ | ||
1085 | P80211DID_MKGROUP(9) | \ | ||
1086 | P80211DID_MKITEM(2) | 0x00000000) | ||
1087 | #define DIDmsg_p2req_mmi_read_resultcode \ | ||
1088 | (P80211DID_MKSECTION(5) | \ | ||
1089 | P80211DID_MKGROUP(9) | \ | ||
1090 | P80211DID_MKITEM(3) | 0x00000000) | ||
1091 | #define DIDmsg_p2req_mmi_write \ | ||
1092 | (P80211DID_MKSECTION(5) | \ | ||
1093 | P80211DID_MKGROUP(10)) | ||
1094 | #define DIDmsg_p2req_mmi_write_addr \ | ||
1095 | (P80211DID_MKSECTION(5) | \ | ||
1096 | P80211DID_MKGROUP(10) | \ | ||
1097 | P80211DID_MKITEM(1) | 0x00000000) | ||
1098 | #define DIDmsg_p2req_mmi_write_data \ | ||
1099 | (P80211DID_MKSECTION(5) | \ | ||
1100 | P80211DID_MKGROUP(10) | \ | ||
1101 | P80211DID_MKITEM(2) | 0x00000000) | ||
1102 | #define DIDmsg_p2req_mmi_write_resultcode \ | ||
1103 | (P80211DID_MKSECTION(5) | \ | ||
1104 | P80211DID_MKGROUP(10) | \ | ||
1105 | P80211DID_MKITEM(3) | 0x00000000) | ||
1106 | #define DIDmsg_p2req_ramdl_state \ | ||
1107 | (P80211DID_MKSECTION(5) | \ | ||
1108 | P80211DID_MKGROUP(11)) | ||
1109 | #define DIDmsg_p2req_ramdl_state_enable \ | ||
1110 | (P80211DID_MKSECTION(5) | \ | ||
1111 | P80211DID_MKGROUP(11) | \ | ||
1112 | P80211DID_MKITEM(1) | 0x00000000) | ||
1113 | #define DIDmsg_p2req_ramdl_state_exeaddr \ | ||
1114 | (P80211DID_MKSECTION(5) | \ | ||
1115 | P80211DID_MKGROUP(11) | \ | ||
1116 | P80211DID_MKITEM(2) | 0x00000000) | ||
1117 | #define DIDmsg_p2req_ramdl_state_resultcode \ | ||
1118 | (P80211DID_MKSECTION(5) | \ | ||
1119 | P80211DID_MKGROUP(11) | \ | ||
1120 | P80211DID_MKITEM(3) | 0x00000000) | ||
1121 | #define DIDmsg_p2req_ramdl_write \ | ||
1122 | (P80211DID_MKSECTION(5) | \ | ||
1123 | P80211DID_MKGROUP(12)) | ||
1124 | #define DIDmsg_p2req_ramdl_write_addr \ | ||
1125 | (P80211DID_MKSECTION(5) | \ | ||
1126 | P80211DID_MKGROUP(12) | \ | ||
1127 | P80211DID_MKITEM(1) | 0x00000000) | ||
1128 | #define DIDmsg_p2req_ramdl_write_len \ | ||
1129 | (P80211DID_MKSECTION(5) | \ | ||
1130 | P80211DID_MKGROUP(12) | \ | ||
1131 | P80211DID_MKITEM(2) | 0x00000000) | ||
1132 | #define DIDmsg_p2req_ramdl_write_data \ | ||
1133 | (P80211DID_MKSECTION(5) | \ | ||
1134 | P80211DID_MKGROUP(12) | \ | ||
1135 | P80211DID_MKITEM(3) | 0x00000000) | ||
1136 | #define DIDmsg_p2req_ramdl_write_resultcode \ | ||
1137 | (P80211DID_MKSECTION(5) | \ | ||
1138 | P80211DID_MKGROUP(12) | \ | ||
1139 | P80211DID_MKITEM(4) | 0x00000000) | ||
1140 | #define DIDmsg_p2req_flashdl_state \ | ||
1141 | (P80211DID_MKSECTION(5) | \ | ||
1142 | P80211DID_MKGROUP(13)) | ||
1143 | #define DIDmsg_p2req_flashdl_state_enable \ | ||
1144 | (P80211DID_MKSECTION(5) | \ | ||
1145 | P80211DID_MKGROUP(13) | \ | ||
1146 | P80211DID_MKITEM(1) | 0x00000000) | ||
1147 | #define DIDmsg_p2req_flashdl_state_resultcode \ | ||
1148 | (P80211DID_MKSECTION(5) | \ | ||
1149 | P80211DID_MKGROUP(13) | \ | ||
1150 | P80211DID_MKITEM(2) | 0x00000000) | ||
1151 | #define DIDmsg_p2req_flashdl_write \ | ||
1152 | (P80211DID_MKSECTION(5) | \ | ||
1153 | P80211DID_MKGROUP(14)) | ||
1154 | #define DIDmsg_p2req_flashdl_write_addr \ | ||
1155 | (P80211DID_MKSECTION(5) | \ | ||
1156 | P80211DID_MKGROUP(14) | \ | ||
1157 | P80211DID_MKITEM(1) | 0x00000000) | ||
1158 | #define DIDmsg_p2req_flashdl_write_len \ | ||
1159 | (P80211DID_MKSECTION(5) | \ | ||
1160 | P80211DID_MKGROUP(14) | \ | ||
1161 | P80211DID_MKITEM(2) | 0x00000000) | ||
1162 | #define DIDmsg_p2req_flashdl_write_data \ | ||
1163 | (P80211DID_MKSECTION(5) | \ | ||
1164 | P80211DID_MKGROUP(14) | \ | ||
1165 | P80211DID_MKITEM(3) | 0x00000000) | ||
1166 | #define DIDmsg_p2req_flashdl_write_resultcode \ | ||
1167 | (P80211DID_MKSECTION(5) | \ | ||
1168 | P80211DID_MKGROUP(14) | \ | ||
1169 | P80211DID_MKITEM(4) | 0x00000000) | ||
1170 | #define DIDmsg_p2req_mm_state \ | ||
1171 | (P80211DID_MKSECTION(5) | \ | ||
1172 | P80211DID_MKGROUP(15)) | ||
1173 | #define DIDmsg_p2req_mm_state_enable \ | ||
1174 | (P80211DID_MKSECTION(5) | \ | ||
1175 | P80211DID_MKGROUP(15) | \ | ||
1176 | P80211DID_MKITEM(1) | 0x00000000) | ||
1177 | #define DIDmsg_p2req_mm_state_resultcode \ | ||
1178 | (P80211DID_MKSECTION(5) | \ | ||
1179 | P80211DID_MKGROUP(15) | \ | ||
1180 | P80211DID_MKITEM(2) | 0x00000000) | ||
1181 | #define DIDmsg_p2req_dump_state \ | ||
1182 | (P80211DID_MKSECTION(5) | \ | ||
1183 | P80211DID_MKGROUP(16)) | ||
1184 | #define DIDmsg_p2req_dump_state_level \ | ||
1185 | (P80211DID_MKSECTION(5) | \ | ||
1186 | P80211DID_MKGROUP(16) | \ | ||
1187 | P80211DID_MKITEM(1) | 0x00000000) | ||
1188 | #define DIDmsg_p2req_dump_state_resultcode \ | ||
1189 | (P80211DID_MKSECTION(5) | \ | ||
1190 | P80211DID_MKGROUP(16) | \ | ||
1191 | P80211DID_MKITEM(2) | 0x00000000) | ||
1192 | #define DIDmsg_p2req_channel_info \ | ||
1193 | (P80211DID_MKSECTION(5) | \ | ||
1194 | P80211DID_MKGROUP(17)) | ||
1195 | #define DIDmsg_p2req_channel_info_channellist \ | ||
1196 | (P80211DID_MKSECTION(5) | \ | ||
1197 | P80211DID_MKGROUP(17) | \ | ||
1198 | P80211DID_MKITEM(1) | 0x00000000) | ||
1199 | #define DIDmsg_p2req_channel_info_channeldwelltime \ | ||
1200 | (P80211DID_MKSECTION(5) | \ | ||
1201 | P80211DID_MKGROUP(17) | \ | ||
1202 | P80211DID_MKITEM(2) | 0x00000000) | ||
1203 | #define DIDmsg_p2req_channel_info_resultcode \ | ||
1204 | (P80211DID_MKSECTION(5) | \ | ||
1205 | P80211DID_MKGROUP(17) | \ | ||
1206 | P80211DID_MKITEM(3) | 0x00000000) | ||
1207 | #define DIDmsg_p2req_channel_info_numchinfo \ | ||
1208 | (P80211DID_MKSECTION(5) | \ | ||
1209 | P80211DID_MKGROUP(17) | \ | ||
1210 | P80211DID_MKITEM(4) | 0x00000000) | ||
1211 | #define DIDmsg_p2req_channel_info_results \ | ||
1212 | (P80211DID_MKSECTION(5) | \ | ||
1213 | P80211DID_MKGROUP(18)) | ||
1214 | #define DIDmsg_p2req_channel_info_results_channel \ | ||
1215 | (P80211DID_MKSECTION(5) | \ | ||
1216 | P80211DID_MKGROUP(18) | \ | ||
1217 | P80211DID_MKITEM(1) | 0x00000000) | ||
1218 | #define DIDmsg_p2req_channel_info_results_resultcode \ | ||
1219 | (P80211DID_MKSECTION(5) | \ | ||
1220 | P80211DID_MKGROUP(18) | \ | ||
1221 | P80211DID_MKITEM(2) | 0x00000000) | ||
1222 | #define DIDmsg_p2req_channel_info_results_avgnoiselevel \ | ||
1223 | (P80211DID_MKSECTION(5) | \ | ||
1224 | P80211DID_MKGROUP(18) | \ | ||
1225 | P80211DID_MKITEM(3) | 0x00000000) | ||
1226 | #define DIDmsg_p2req_channel_info_results_peaknoiselevel \ | ||
1227 | (P80211DID_MKSECTION(5) | \ | ||
1228 | P80211DID_MKGROUP(18) | \ | ||
1229 | P80211DID_MKITEM(4) | 0x00000000) | ||
1230 | #define DIDmsg_p2req_channel_info_results_bssactive \ | ||
1231 | (P80211DID_MKSECTION(5) | \ | ||
1232 | P80211DID_MKGROUP(18) | \ | ||
1233 | P80211DID_MKITEM(5) | 0x00000000) | ||
1234 | #define DIDmsg_p2req_channel_info_results_pcfactive \ | ||
1235 | (P80211DID_MKSECTION(5) | \ | ||
1236 | P80211DID_MKGROUP(18) | \ | ||
1237 | P80211DID_MKITEM(6) | 0x00000000) | ||
1238 | #define DIDmsg_p2req_enable \ | ||
1239 | (P80211DID_MKSECTION(5) | \ | ||
1240 | P80211DID_MKGROUP(19)) | ||
1241 | #define DIDmsg_p2req_enable_resultcode \ | ||
1242 | (P80211DID_MKSECTION(5) | \ | ||
1243 | P80211DID_MKGROUP(19) | \ | ||
1244 | P80211DID_MKITEM(1) | 0x00000000) | ||
1245 | #define DIDmib_cat_dot11smt \ | ||
1246 | P80211DID_MKSECTION(1) | ||
1247 | #define DIDmib_dot11smt_p80211Table \ | ||
1248 | (P80211DID_MKSECTION(1) | \ | ||
1249 | P80211DID_MKGROUP(1)) | ||
1250 | #define DIDmib_dot11smt_p80211Table_p80211_ifstate \ | ||
1251 | (P80211DID_MKSECTION(1) | \ | ||
1252 | P80211DID_MKGROUP(1) | \ | ||
1253 | P80211DID_MKITEM(1) | 0x10000000) | ||
1254 | #define DIDmib_dot11smt_dot11StationConfigTable \ | ||
1255 | (P80211DID_MKSECTION(1) | \ | ||
1256 | P80211DID_MKGROUP(2)) | ||
1257 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11StationID \ | ||
1258 | (P80211DID_MKSECTION(1) | \ | ||
1259 | P80211DID_MKGROUP(2) | \ | ||
1260 | P80211DID_MKITEM(1) | 0x18000000) | ||
1261 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11MediumOccupancyLimit \ | ||
1262 | (P80211DID_MKSECTION(1) | \ | ||
1263 | P80211DID_MKGROUP(2) | \ | ||
1264 | P80211DID_MKITEM(2) | 0x18000000) | ||
1265 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11CFPollable \ | ||
1266 | (P80211DID_MKSECTION(1) | \ | ||
1267 | P80211DID_MKGROUP(2) | \ | ||
1268 | P80211DID_MKITEM(3) | 0x10000000) | ||
1269 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11CFPPeriod \ | ||
1270 | (P80211DID_MKSECTION(1) | \ | ||
1271 | P80211DID_MKGROUP(2) | \ | ||
1272 | P80211DID_MKITEM(4) | 0x18000000) | ||
1273 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11CFPMaxDuration \ | ||
1274 | (P80211DID_MKSECTION(1) | \ | ||
1275 | P80211DID_MKGROUP(2) | \ | ||
1276 | P80211DID_MKITEM(5) | 0x18000000) | ||
1277 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticationResponseTimeOut \ | ||
1278 | (P80211DID_MKSECTION(1) | \ | ||
1279 | P80211DID_MKGROUP(2) | \ | ||
1280 | P80211DID_MKITEM(6) | 0x18000000) | ||
1281 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11PrivacyOptionImplemented \ | ||
1282 | (P80211DID_MKSECTION(1) | \ | ||
1283 | P80211DID_MKGROUP(2) | \ | ||
1284 | P80211DID_MKITEM(7) | 0x10000000) | ||
1285 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11PowerManagementMode \ | ||
1286 | (P80211DID_MKSECTION(1) | \ | ||
1287 | P80211DID_MKGROUP(2) | \ | ||
1288 | P80211DID_MKITEM(8) | 0x18000000) | ||
1289 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredSSID \ | ||
1290 | (P80211DID_MKSECTION(1) | \ | ||
1291 | P80211DID_MKGROUP(2) | \ | ||
1292 | P80211DID_MKITEM(9) | 0x18000000) | ||
1293 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType \ | ||
1294 | (P80211DID_MKSECTION(1) | \ | ||
1295 | P80211DID_MKGROUP(2) | \ | ||
1296 | P80211DID_MKITEM(10) | 0x18000000) | ||
1297 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet \ | ||
1298 | (P80211DID_MKSECTION(1) | \ | ||
1299 | P80211DID_MKGROUP(2) | \ | ||
1300 | P80211DID_MKITEM(11) | 0x18000000) | ||
1301 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11BeaconPeriod \ | ||
1302 | (P80211DID_MKSECTION(1) | \ | ||
1303 | P80211DID_MKGROUP(2) | \ | ||
1304 | P80211DID_MKITEM(12) | 0x18000000) | ||
1305 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11DTIMPeriod \ | ||
1306 | (P80211DID_MKSECTION(1) | \ | ||
1307 | P80211DID_MKGROUP(2) | \ | ||
1308 | P80211DID_MKITEM(13) | 0x18000000) | ||
1309 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11AssociationResponseTimeOut \ | ||
1310 | (P80211DID_MKSECTION(1) | \ | ||
1311 | P80211DID_MKGROUP(2) | \ | ||
1312 | P80211DID_MKITEM(14) | 0x10000000) | ||
1313 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11DisassociateReason \ | ||
1314 | (P80211DID_MKSECTION(1) | \ | ||
1315 | P80211DID_MKGROUP(2) | \ | ||
1316 | P80211DID_MKITEM(15) | 0x10000000) | ||
1317 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11DisassociateStation \ | ||
1318 | (P80211DID_MKSECTION(1) | \ | ||
1319 | P80211DID_MKGROUP(2) | \ | ||
1320 | P80211DID_MKITEM(16) | 0x10000000) | ||
1321 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11DeauthenticateReason \ | ||
1322 | (P80211DID_MKSECTION(1) | \ | ||
1323 | P80211DID_MKGROUP(2) | \ | ||
1324 | P80211DID_MKITEM(17) | 0x10000000) | ||
1325 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11DeauthenticateStation \ | ||
1326 | (P80211DID_MKSECTION(1) | \ | ||
1327 | P80211DID_MKGROUP(2) | \ | ||
1328 | P80211DID_MKITEM(18) | 0x10000000) | ||
1329 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticateFailStatus \ | ||
1330 | (P80211DID_MKSECTION(1) | \ | ||
1331 | P80211DID_MKGROUP(2) | \ | ||
1332 | P80211DID_MKITEM(19) | 0x10000000) | ||
1333 | #define DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticateFailStation \ | ||
1334 | (P80211DID_MKSECTION(1) | \ | ||
1335 | P80211DID_MKGROUP(2) | \ | ||
1336 | P80211DID_MKITEM(20) | 0x10000000) | ||
1337 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable \ | ||
1338 | (P80211DID_MKSECTION(1) | \ | ||
1339 | P80211DID_MKGROUP(3)) | ||
1340 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm1 \ | ||
1341 | (P80211DID_MKSECTION(1) | \ | ||
1342 | P80211DID_MKGROUP(3) | \ | ||
1343 | P80211DID_MKITEM(1) | 0x14000000) | ||
1344 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable1 \ | ||
1345 | (P80211DID_MKSECTION(1) | \ | ||
1346 | P80211DID_MKGROUP(3) | \ | ||
1347 | P80211DID_MKITEM(2) | 0x1c000000) | ||
1348 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm2 \ | ||
1349 | (P80211DID_MKSECTION(1) | \ | ||
1350 | P80211DID_MKGROUP(3) | \ | ||
1351 | P80211DID_MKITEM(3) | 0x14000000) | ||
1352 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable2 \ | ||
1353 | (P80211DID_MKSECTION(1) | \ | ||
1354 | P80211DID_MKGROUP(3) | \ | ||
1355 | P80211DID_MKITEM(4) | 0x1c000000) | ||
1356 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm3 \ | ||
1357 | (P80211DID_MKSECTION(1) | \ | ||
1358 | P80211DID_MKGROUP(3) | \ | ||
1359 | P80211DID_MKITEM(5) | 0x14000000) | ||
1360 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable3 \ | ||
1361 | (P80211DID_MKSECTION(1) | \ | ||
1362 | P80211DID_MKGROUP(3) | \ | ||
1363 | P80211DID_MKITEM(6) | 0x1c000000) | ||
1364 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm4 \ | ||
1365 | (P80211DID_MKSECTION(1) | \ | ||
1366 | P80211DID_MKGROUP(3) | \ | ||
1367 | P80211DID_MKITEM(7) | 0x14000000) | ||
1368 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable4 \ | ||
1369 | (P80211DID_MKSECTION(1) | \ | ||
1370 | P80211DID_MKGROUP(3) | \ | ||
1371 | P80211DID_MKITEM(8) | 0x1c000000) | ||
1372 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm5 \ | ||
1373 | (P80211DID_MKSECTION(1) | \ | ||
1374 | P80211DID_MKGROUP(3) | \ | ||
1375 | P80211DID_MKITEM(9) | 0x14000000) | ||
1376 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable5 \ | ||
1377 | (P80211DID_MKSECTION(1) | \ | ||
1378 | P80211DID_MKGROUP(3) | \ | ||
1379 | P80211DID_MKITEM(10) | 0x1c000000) | ||
1380 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm6 \ | ||
1381 | (P80211DID_MKSECTION(1) | \ | ||
1382 | P80211DID_MKGROUP(3) | \ | ||
1383 | P80211DID_MKITEM(11) | 0x14000000) | ||
1384 | #define DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable6 \ | ||
1385 | (P80211DID_MKSECTION(1) | \ | ||
1386 | P80211DID_MKGROUP(3) | \ | ||
1387 | P80211DID_MKITEM(12) | 0x1c000000) | ||
1388 | #define DIDmib_dot11smt_dot11WEPDefaultKeysTable \ | ||
1389 | (P80211DID_MKSECTION(1) | \ | ||
1390 | P80211DID_MKGROUP(4)) | ||
1391 | #define DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0 \ | ||
1392 | (P80211DID_MKSECTION(1) | \ | ||
1393 | P80211DID_MKGROUP(4) | \ | ||
1394 | P80211DID_MKITEM(1) | 0x0c000000) | ||
1395 | #define DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1 \ | ||
1396 | (P80211DID_MKSECTION(1) | \ | ||
1397 | P80211DID_MKGROUP(4) | \ | ||
1398 | P80211DID_MKITEM(2) | 0x0c000000) | ||
1399 | #define DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2 \ | ||
1400 | (P80211DID_MKSECTION(1) | \ | ||
1401 | P80211DID_MKGROUP(4) | \ | ||
1402 | P80211DID_MKITEM(3) | 0x0c000000) | ||
1403 | #define DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3 \ | ||
1404 | (P80211DID_MKSECTION(1) | \ | ||
1405 | P80211DID_MKGROUP(4) | \ | ||
1406 | P80211DID_MKITEM(4) | 0x0c000000) | ||
1407 | #define DIDmib_dot11smt_dot11WEPKeyMappingsTable \ | ||
1408 | (P80211DID_MKSECTION(1) | \ | ||
1409 | P80211DID_MKGROUP(5)) | ||
1410 | #define DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingIndex \ | ||
1411 | (P80211DID_MKSECTION(1) | \ | ||
1412 | P80211DID_MKGROUP(5) | \ | ||
1413 | P80211DID_MKITEM(1) | 0x1c000000) | ||
1414 | #define DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingAddress \ | ||
1415 | (P80211DID_MKSECTION(1) | \ | ||
1416 | P80211DID_MKGROUP(5) | \ | ||
1417 | P80211DID_MKITEM(2) | 0x1c000000) | ||
1418 | #define DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingWEPOn \ | ||
1419 | (P80211DID_MKSECTION(1) | \ | ||
1420 | P80211DID_MKGROUP(5) | \ | ||
1421 | P80211DID_MKITEM(3) | 0x1c000000) | ||
1422 | #define DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingValue \ | ||
1423 | (P80211DID_MKSECTION(1) | \ | ||
1424 | P80211DID_MKGROUP(5) | \ | ||
1425 | P80211DID_MKITEM(4) | 0x1c000000) | ||
1426 | #define DIDmib_dot11smt_dot11PrivacyTable \ | ||
1427 | (P80211DID_MKSECTION(1) | \ | ||
1428 | P80211DID_MKGROUP(6)) | ||
1429 | #define DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked \ | ||
1430 | (P80211DID_MKSECTION(1) | \ | ||
1431 | P80211DID_MKGROUP(6) | \ | ||
1432 | P80211DID_MKITEM(1) | 0x18000000) | ||
1433 | #define DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID \ | ||
1434 | (P80211DID_MKSECTION(1) | \ | ||
1435 | P80211DID_MKGROUP(6) | \ | ||
1436 | P80211DID_MKITEM(2) | 0x18000000) | ||
1437 | #define DIDmib_dot11smt_dot11PrivacyTable_dot11WEPKeyMappingLength \ | ||
1438 | (P80211DID_MKSECTION(1) | \ | ||
1439 | P80211DID_MKGROUP(6) | \ | ||
1440 | P80211DID_MKITEM(3) | 0x18000000) | ||
1441 | #define DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted \ | ||
1442 | (P80211DID_MKSECTION(1) | \ | ||
1443 | P80211DID_MKGROUP(6) | \ | ||
1444 | P80211DID_MKITEM(4) | 0x18000000) | ||
1445 | #define DIDmib_dot11smt_dot11PrivacyTable_dot11WEPICVErrorCount \ | ||
1446 | (P80211DID_MKSECTION(1) | \ | ||
1447 | P80211DID_MKGROUP(6) | \ | ||
1448 | P80211DID_MKITEM(5) | 0x10000000) | ||
1449 | #define DIDmib_dot11smt_dot11PrivacyTable_dot11WEPExcludedCount \ | ||
1450 | (P80211DID_MKSECTION(1) | \ | ||
1451 | P80211DID_MKGROUP(6) | \ | ||
1452 | P80211DID_MKITEM(6) | 0x10000000) | ||
1453 | #define DIDmib_cat_dot11mac \ | ||
1454 | P80211DID_MKSECTION(2) | ||
1455 | #define DIDmib_dot11mac_dot11OperationTable \ | ||
1456 | (P80211DID_MKSECTION(2) | \ | ||
1457 | P80211DID_MKGROUP(1)) | ||
1458 | #define DIDmib_dot11mac_dot11OperationTable_dot11MACAddress \ | ||
1459 | (P80211DID_MKSECTION(2) | \ | ||
1460 | P80211DID_MKGROUP(1) | \ | ||
1461 | P80211DID_MKITEM(1) | 0x18000000) | ||
1462 | #define DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold \ | ||
1463 | (P80211DID_MKSECTION(2) | \ | ||
1464 | P80211DID_MKGROUP(1) | \ | ||
1465 | P80211DID_MKITEM(2) | 0x18000000) | ||
1466 | #define DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit \ | ||
1467 | (P80211DID_MKSECTION(2) | \ | ||
1468 | P80211DID_MKGROUP(1) | \ | ||
1469 | P80211DID_MKITEM(3) | 0x10000000) | ||
1470 | #define DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit \ | ||
1471 | (P80211DID_MKSECTION(2) | \ | ||
1472 | P80211DID_MKGROUP(1) | \ | ||
1473 | P80211DID_MKITEM(4) | 0x10000000) | ||
1474 | #define DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold \ | ||
1475 | (P80211DID_MKSECTION(2) | \ | ||
1476 | P80211DID_MKGROUP(1) | \ | ||
1477 | P80211DID_MKITEM(5) | 0x18000000) | ||
1478 | #define DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime \ | ||
1479 | (P80211DID_MKSECTION(2) | \ | ||
1480 | P80211DID_MKGROUP(1) | \ | ||
1481 | P80211DID_MKITEM(6) | 0x10000000) | ||
1482 | #define DIDmib_dot11mac_dot11OperationTable_dot11MaxReceiveLifetime \ | ||
1483 | (P80211DID_MKSECTION(2) | \ | ||
1484 | P80211DID_MKGROUP(1) | \ | ||
1485 | P80211DID_MKITEM(7) | 0x10000000) | ||
1486 | #define DIDmib_dot11mac_dot11OperationTable_dot11ManufacturerID \ | ||
1487 | (P80211DID_MKSECTION(2) | \ | ||
1488 | P80211DID_MKGROUP(1) | \ | ||
1489 | P80211DID_MKITEM(8) | 0x10000000) | ||
1490 | #define DIDmib_dot11mac_dot11OperationTable_dot11ProductID \ | ||
1491 | (P80211DID_MKSECTION(2) | \ | ||
1492 | P80211DID_MKGROUP(1) | \ | ||
1493 | P80211DID_MKITEM(9) | 0x10000000) | ||
1494 | #define DIDmib_dot11mac_dot11CountersTable \ | ||
1495 | (P80211DID_MKSECTION(2) | \ | ||
1496 | P80211DID_MKGROUP(2)) | ||
1497 | #define DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFragmentCount \ | ||
1498 | (P80211DID_MKSECTION(2) | \ | ||
1499 | P80211DID_MKGROUP(2) | \ | ||
1500 | P80211DID_MKITEM(1) | 0x10000000) | ||
1501 | #define DIDmib_dot11mac_dot11CountersTable_dot11MulticastTransmittedFrameCount \ | ||
1502 | (P80211DID_MKSECTION(2) | \ | ||
1503 | P80211DID_MKGROUP(2) | \ | ||
1504 | P80211DID_MKITEM(2) | 0x10000000) | ||
1505 | #define DIDmib_dot11mac_dot11CountersTable_dot11FailedCount \ | ||
1506 | (P80211DID_MKSECTION(2) | \ | ||
1507 | P80211DID_MKGROUP(2) | \ | ||
1508 | P80211DID_MKITEM(3) | 0x10000000) | ||
1509 | #define DIDmib_dot11mac_dot11CountersTable_dot11RetryCount \ | ||
1510 | (P80211DID_MKSECTION(2) | \ | ||
1511 | P80211DID_MKGROUP(2) | \ | ||
1512 | P80211DID_MKITEM(4) | 0x10000000) | ||
1513 | #define DIDmib_dot11mac_dot11CountersTable_dot11MultipleRetryCount \ | ||
1514 | (P80211DID_MKSECTION(2) | \ | ||
1515 | P80211DID_MKGROUP(2) | \ | ||
1516 | P80211DID_MKITEM(5) | 0x10000000) | ||
1517 | #define DIDmib_dot11mac_dot11CountersTable_dot11FrameDuplicateCount \ | ||
1518 | (P80211DID_MKSECTION(2) | \ | ||
1519 | P80211DID_MKGROUP(2) | \ | ||
1520 | P80211DID_MKITEM(6) | 0x10000000) | ||
1521 | #define DIDmib_dot11mac_dot11CountersTable_dot11RTSSuccessCount \ | ||
1522 | (P80211DID_MKSECTION(2) | \ | ||
1523 | P80211DID_MKGROUP(2) | \ | ||
1524 | P80211DID_MKITEM(7) | 0x10000000) | ||
1525 | #define DIDmib_dot11mac_dot11CountersTable_dot11RTSFailureCount \ | ||
1526 | (P80211DID_MKSECTION(2) | \ | ||
1527 | P80211DID_MKGROUP(2) | \ | ||
1528 | P80211DID_MKITEM(8) | 0x10000000) | ||
1529 | #define DIDmib_dot11mac_dot11CountersTable_dot11ACKFailureCount \ | ||
1530 | (P80211DID_MKSECTION(2) | \ | ||
1531 | P80211DID_MKGROUP(2) | \ | ||
1532 | P80211DID_MKITEM(9) | 0x10000000) | ||
1533 | #define DIDmib_dot11mac_dot11CountersTable_dot11ReceivedFragmentCount \ | ||
1534 | (P80211DID_MKSECTION(2) | \ | ||
1535 | P80211DID_MKGROUP(2) | \ | ||
1536 | P80211DID_MKITEM(10) | 0x10000000) | ||
1537 | #define DIDmib_dot11mac_dot11CountersTable_dot11MulticastReceivedFrameCount \ | ||
1538 | (P80211DID_MKSECTION(2) | \ | ||
1539 | P80211DID_MKGROUP(2) | \ | ||
1540 | P80211DID_MKITEM(11) | 0x10000000) | ||
1541 | #define DIDmib_dot11mac_dot11CountersTable_dot11FCSErrorCount \ | ||
1542 | (P80211DID_MKSECTION(2) | \ | ||
1543 | P80211DID_MKGROUP(2) | \ | ||
1544 | P80211DID_MKITEM(12) | 0x10000000) | ||
1545 | #define DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFrameCount \ | ||
1546 | (P80211DID_MKSECTION(2) | \ | ||
1547 | P80211DID_MKGROUP(2) | \ | ||
1548 | P80211DID_MKITEM(13) | 0x10000000) | ||
1549 | #define DIDmib_dot11mac_dot11CountersTable_dot11WEPUndecryptableCount \ | ||
1550 | (P80211DID_MKSECTION(2) | \ | ||
1551 | P80211DID_MKGROUP(2) | \ | ||
1552 | P80211DID_MKITEM(14) | 0x10000000) | ||
1553 | #define DIDmib_dot11mac_dot11GroupAddressesTable \ | ||
1554 | (P80211DID_MKSECTION(2) | \ | ||
1555 | P80211DID_MKGROUP(3)) | ||
1556 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1 \ | ||
1557 | (P80211DID_MKSECTION(2) | \ | ||
1558 | P80211DID_MKGROUP(3) | \ | ||
1559 | P80211DID_MKITEM(1) | 0x1c000000) | ||
1560 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2 \ | ||
1561 | (P80211DID_MKSECTION(2) | \ | ||
1562 | P80211DID_MKGROUP(3) | \ | ||
1563 | P80211DID_MKITEM(2) | 0x1c000000) | ||
1564 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3 \ | ||
1565 | (P80211DID_MKSECTION(2) | \ | ||
1566 | P80211DID_MKGROUP(3) | \ | ||
1567 | P80211DID_MKITEM(3) | 0x1c000000) | ||
1568 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4 \ | ||
1569 | (P80211DID_MKSECTION(2) | \ | ||
1570 | P80211DID_MKGROUP(3) | \ | ||
1571 | P80211DID_MKITEM(4) | 0x1c000000) | ||
1572 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5 \ | ||
1573 | (P80211DID_MKSECTION(2) | \ | ||
1574 | P80211DID_MKGROUP(3) | \ | ||
1575 | P80211DID_MKITEM(5) | 0x1c000000) | ||
1576 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6 \ | ||
1577 | (P80211DID_MKSECTION(2) | \ | ||
1578 | P80211DID_MKGROUP(3) | \ | ||
1579 | P80211DID_MKITEM(6) | 0x1c000000) | ||
1580 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7 \ | ||
1581 | (P80211DID_MKSECTION(2) | \ | ||
1582 | P80211DID_MKGROUP(3) | \ | ||
1583 | P80211DID_MKITEM(7) | 0x1c000000) | ||
1584 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8 \ | ||
1585 | (P80211DID_MKSECTION(2) | \ | ||
1586 | P80211DID_MKGROUP(3) | \ | ||
1587 | P80211DID_MKITEM(8) | 0x1c000000) | ||
1588 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9 \ | ||
1589 | (P80211DID_MKSECTION(2) | \ | ||
1590 | P80211DID_MKGROUP(3) | \ | ||
1591 | P80211DID_MKITEM(9) | 0x1c000000) | ||
1592 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10 \ | ||
1593 | (P80211DID_MKSECTION(2) | \ | ||
1594 | P80211DID_MKGROUP(3) | \ | ||
1595 | P80211DID_MKITEM(10) | 0x1c000000) | ||
1596 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11 \ | ||
1597 | (P80211DID_MKSECTION(2) | \ | ||
1598 | P80211DID_MKGROUP(3) | \ | ||
1599 | P80211DID_MKITEM(11) | 0x1c000000) | ||
1600 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12 \ | ||
1601 | (P80211DID_MKSECTION(2) | \ | ||
1602 | P80211DID_MKGROUP(3) | \ | ||
1603 | P80211DID_MKITEM(12) | 0x1c000000) | ||
1604 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13 \ | ||
1605 | (P80211DID_MKSECTION(2) | \ | ||
1606 | P80211DID_MKGROUP(3) | \ | ||
1607 | P80211DID_MKITEM(13) | 0x1c000000) | ||
1608 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14 \ | ||
1609 | (P80211DID_MKSECTION(2) | \ | ||
1610 | P80211DID_MKGROUP(3) | \ | ||
1611 | P80211DID_MKITEM(14) | 0x1c000000) | ||
1612 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15 \ | ||
1613 | (P80211DID_MKSECTION(2) | \ | ||
1614 | P80211DID_MKGROUP(3) | \ | ||
1615 | P80211DID_MKITEM(15) | 0x1c000000) | ||
1616 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16 \ | ||
1617 | (P80211DID_MKSECTION(2) | \ | ||
1618 | P80211DID_MKGROUP(3) | \ | ||
1619 | P80211DID_MKITEM(16) | 0x1c000000) | ||
1620 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17 \ | ||
1621 | (P80211DID_MKSECTION(2) | \ | ||
1622 | P80211DID_MKGROUP(3) | \ | ||
1623 | P80211DID_MKITEM(17) | 0x1c000000) | ||
1624 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18 \ | ||
1625 | (P80211DID_MKSECTION(2) | \ | ||
1626 | P80211DID_MKGROUP(3) | \ | ||
1627 | P80211DID_MKITEM(18) | 0x1c000000) | ||
1628 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19 \ | ||
1629 | (P80211DID_MKSECTION(2) | \ | ||
1630 | P80211DID_MKGROUP(3) | \ | ||
1631 | P80211DID_MKITEM(19) | 0x1c000000) | ||
1632 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20 \ | ||
1633 | (P80211DID_MKSECTION(2) | \ | ||
1634 | P80211DID_MKGROUP(3) | \ | ||
1635 | P80211DID_MKITEM(20) | 0x1c000000) | ||
1636 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21 \ | ||
1637 | (P80211DID_MKSECTION(2) | \ | ||
1638 | P80211DID_MKGROUP(3) | \ | ||
1639 | P80211DID_MKITEM(21) | 0x1c000000) | ||
1640 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22 \ | ||
1641 | (P80211DID_MKSECTION(2) | \ | ||
1642 | P80211DID_MKGROUP(3) | \ | ||
1643 | P80211DID_MKITEM(22) | 0x1c000000) | ||
1644 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23 \ | ||
1645 | (P80211DID_MKSECTION(2) | \ | ||
1646 | P80211DID_MKGROUP(3) | \ | ||
1647 | P80211DID_MKITEM(23) | 0x1c000000) | ||
1648 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24 \ | ||
1649 | (P80211DID_MKSECTION(2) | \ | ||
1650 | P80211DID_MKGROUP(3) | \ | ||
1651 | P80211DID_MKITEM(24) | 0x1c000000) | ||
1652 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25 \ | ||
1653 | (P80211DID_MKSECTION(2) | \ | ||
1654 | P80211DID_MKGROUP(3) | \ | ||
1655 | P80211DID_MKITEM(25) | 0x1c000000) | ||
1656 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26 \ | ||
1657 | (P80211DID_MKSECTION(2) | \ | ||
1658 | P80211DID_MKGROUP(3) | \ | ||
1659 | P80211DID_MKITEM(26) | 0x1c000000) | ||
1660 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27 \ | ||
1661 | (P80211DID_MKSECTION(2) | \ | ||
1662 | P80211DID_MKGROUP(3) | \ | ||
1663 | P80211DID_MKITEM(27) | 0x1c000000) | ||
1664 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28 \ | ||
1665 | (P80211DID_MKSECTION(2) | \ | ||
1666 | P80211DID_MKGROUP(3) | \ | ||
1667 | P80211DID_MKITEM(28) | 0x1c000000) | ||
1668 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29 \ | ||
1669 | (P80211DID_MKSECTION(2) | \ | ||
1670 | P80211DID_MKGROUP(3) | \ | ||
1671 | P80211DID_MKITEM(29) | 0x1c000000) | ||
1672 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30 \ | ||
1673 | (P80211DID_MKSECTION(2) | \ | ||
1674 | P80211DID_MKGROUP(3) | \ | ||
1675 | P80211DID_MKITEM(30) | 0x1c000000) | ||
1676 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31 \ | ||
1677 | (P80211DID_MKSECTION(2) | \ | ||
1678 | P80211DID_MKGROUP(3) | \ | ||
1679 | P80211DID_MKITEM(31) | 0x1c000000) | ||
1680 | #define DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32 \ | ||
1681 | (P80211DID_MKSECTION(2) | \ | ||
1682 | P80211DID_MKGROUP(3) | \ | ||
1683 | P80211DID_MKITEM(32) | 0x1c000000) | ||
1684 | #define DIDmib_cat_dot11phy \ | ||
1685 | P80211DID_MKSECTION(3) | ||
1686 | #define DIDmib_dot11phy_dot11PhyOperationTable \ | ||
1687 | (P80211DID_MKSECTION(3) | \ | ||
1688 | P80211DID_MKGROUP(1)) | ||
1689 | #define DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType \ | ||
1690 | (P80211DID_MKSECTION(3) | \ | ||
1691 | P80211DID_MKGROUP(1) | \ | ||
1692 | P80211DID_MKITEM(1) | 0x10000000) | ||
1693 | #define DIDmib_dot11phy_dot11PhyOperationTable_dot11CurrentRegDomain \ | ||
1694 | (P80211DID_MKSECTION(3) | \ | ||
1695 | P80211DID_MKGROUP(1) | \ | ||
1696 | P80211DID_MKITEM(2) | 0x18000000) | ||
1697 | #define DIDmib_dot11phy_dot11PhyOperationTable_dot11TempType \ | ||
1698 | (P80211DID_MKSECTION(3) | \ | ||
1699 | P80211DID_MKGROUP(1) | \ | ||
1700 | P80211DID_MKITEM(3) | 0x10000000) | ||
1701 | #define DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityPresent \ | ||
1702 | (P80211DID_MKSECTION(3) | \ | ||
1703 | P80211DID_MKGROUP(1) | \ | ||
1704 | P80211DID_MKITEM(4) | 0x10000000) | ||
1705 | #define DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityEnabled \ | ||
1706 | (P80211DID_MKSECTION(3) | \ | ||
1707 | P80211DID_MKGROUP(1) | \ | ||
1708 | P80211DID_MKITEM(5) | 0x10000000) | ||
1709 | #define DIDmib_dot11phy_dot11PhyOperationTable_dot11ShortPreambleEnabled \ | ||
1710 | (P80211DID_MKSECTION(3) | \ | ||
1711 | P80211DID_MKGROUP(1) | \ | ||
1712 | P80211DID_MKITEM(6) | 0x10000000) | ||
1713 | #define DIDmib_dot11phy_dot11PhyAntennaTable \ | ||
1714 | (P80211DID_MKSECTION(3) | \ | ||
1715 | P80211DID_MKGROUP(2)) | ||
1716 | #define DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentTxAntenna \ | ||
1717 | (P80211DID_MKSECTION(3) | \ | ||
1718 | P80211DID_MKGROUP(2) | \ | ||
1719 | P80211DID_MKITEM(1) | 0x18000000) | ||
1720 | #define DIDmib_dot11phy_dot11PhyAntennaTable_dot11DiversitySupport \ | ||
1721 | (P80211DID_MKSECTION(3) | \ | ||
1722 | P80211DID_MKGROUP(2) | \ | ||
1723 | P80211DID_MKITEM(2) | 0x10000000) | ||
1724 | #define DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentRxAntenna \ | ||
1725 | (P80211DID_MKSECTION(3) | \ | ||
1726 | P80211DID_MKGROUP(2) | \ | ||
1727 | P80211DID_MKITEM(3) | 0x18000000) | ||
1728 | #define DIDmib_dot11phy_dot11PhyTxPowerTable \ | ||
1729 | (P80211DID_MKSECTION(3) | \ | ||
1730 | P80211DID_MKGROUP(3)) | ||
1731 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11NumberSupportedPowerLevels \ | ||
1732 | (P80211DID_MKSECTION(3) | \ | ||
1733 | P80211DID_MKGROUP(3) | \ | ||
1734 | P80211DID_MKITEM(1) | 0x10000000) | ||
1735 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1 \ | ||
1736 | (P80211DID_MKSECTION(3) | \ | ||
1737 | P80211DID_MKGROUP(3) | \ | ||
1738 | P80211DID_MKITEM(2) | 0x10000000) | ||
1739 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2 \ | ||
1740 | (P80211DID_MKSECTION(3) | \ | ||
1741 | P80211DID_MKGROUP(3) | \ | ||
1742 | P80211DID_MKITEM(3) | 0x10000000) | ||
1743 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3 \ | ||
1744 | (P80211DID_MKSECTION(3) | \ | ||
1745 | P80211DID_MKGROUP(3) | \ | ||
1746 | P80211DID_MKITEM(4) | 0x10000000) | ||
1747 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4 \ | ||
1748 | (P80211DID_MKSECTION(3) | \ | ||
1749 | P80211DID_MKGROUP(3) | \ | ||
1750 | P80211DID_MKITEM(5) | 0x10000000) | ||
1751 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5 \ | ||
1752 | (P80211DID_MKSECTION(3) | \ | ||
1753 | P80211DID_MKGROUP(3) | \ | ||
1754 | P80211DID_MKITEM(6) | 0x10000000) | ||
1755 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6 \ | ||
1756 | (P80211DID_MKSECTION(3) | \ | ||
1757 | P80211DID_MKGROUP(3) | \ | ||
1758 | P80211DID_MKITEM(7) | 0x10000000) | ||
1759 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7 \ | ||
1760 | (P80211DID_MKSECTION(3) | \ | ||
1761 | P80211DID_MKGROUP(3) | \ | ||
1762 | P80211DID_MKITEM(8) | 0x10000000) | ||
1763 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8 \ | ||
1764 | (P80211DID_MKSECTION(3) | \ | ||
1765 | P80211DID_MKGROUP(3) | \ | ||
1766 | P80211DID_MKITEM(9) | 0x10000000) | ||
1767 | #define DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel \ | ||
1768 | (P80211DID_MKSECTION(3) | \ | ||
1769 | P80211DID_MKGROUP(3) | \ | ||
1770 | P80211DID_MKITEM(10) | 0x18000000) | ||
1771 | #define DIDmib_dot11phy_dot11PhyFHSSTable \ | ||
1772 | (P80211DID_MKSECTION(3) | \ | ||
1773 | P80211DID_MKGROUP(4)) | ||
1774 | #define DIDmib_dot11phy_dot11PhyFHSSTable_dot11HopTime \ | ||
1775 | (P80211DID_MKSECTION(3) | \ | ||
1776 | P80211DID_MKGROUP(4) | \ | ||
1777 | P80211DID_MKITEM(1) | 0x10000000) | ||
1778 | #define DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentChannelNumber \ | ||
1779 | (P80211DID_MKSECTION(3) | \ | ||
1780 | P80211DID_MKGROUP(4) | \ | ||
1781 | P80211DID_MKITEM(2) | 0x18000000) | ||
1782 | #define DIDmib_dot11phy_dot11PhyFHSSTable_dot11MaxDwellTime \ | ||
1783 | (P80211DID_MKSECTION(3) | \ | ||
1784 | P80211DID_MKGROUP(4) | \ | ||
1785 | P80211DID_MKITEM(3) | 0x10000000) | ||
1786 | #define DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentDwellTime \ | ||
1787 | (P80211DID_MKSECTION(3) | \ | ||
1788 | P80211DID_MKGROUP(4) | \ | ||
1789 | P80211DID_MKITEM(4) | 0x18000000) | ||
1790 | #define DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentSet \ | ||
1791 | (P80211DID_MKSECTION(3) | \ | ||
1792 | P80211DID_MKGROUP(4) | \ | ||
1793 | P80211DID_MKITEM(5) | 0x18000000) | ||
1794 | #define DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentPattern \ | ||
1795 | (P80211DID_MKSECTION(3) | \ | ||
1796 | P80211DID_MKGROUP(4) | \ | ||
1797 | P80211DID_MKITEM(6) | 0x18000000) | ||
1798 | #define DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentIndex \ | ||
1799 | (P80211DID_MKSECTION(3) | \ | ||
1800 | P80211DID_MKGROUP(4) | \ | ||
1801 | P80211DID_MKITEM(7) | 0x18000000) | ||
1802 | #define DIDmib_dot11phy_dot11PhyDSSSTable \ | ||
1803 | (P80211DID_MKSECTION(3) | \ | ||
1804 | P80211DID_MKGROUP(5)) | ||
1805 | #define DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel \ | ||
1806 | (P80211DID_MKSECTION(3) | \ | ||
1807 | P80211DID_MKGROUP(5) | \ | ||
1808 | P80211DID_MKITEM(1) | 0x10000000) | ||
1809 | #define DIDmib_dot11phy_dot11PhyDSSSTable_dot11CCAModeSupported \ | ||
1810 | (P80211DID_MKSECTION(3) | \ | ||
1811 | P80211DID_MKGROUP(5) | \ | ||
1812 | P80211DID_MKITEM(2) | 0x10000000) | ||
1813 | #define DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentCCAMode \ | ||
1814 | (P80211DID_MKSECTION(3) | \ | ||
1815 | P80211DID_MKGROUP(5) | \ | ||
1816 | P80211DID_MKITEM(3) | 0x10000000) | ||
1817 | #define DIDmib_dot11phy_dot11PhyDSSSTable_dot11EDThreshold \ | ||
1818 | (P80211DID_MKSECTION(3) | \ | ||
1819 | P80211DID_MKGROUP(5) | \ | ||
1820 | P80211DID_MKITEM(4) | 0x18000000) | ||
1821 | #define DIDmib_dot11phy_dot11PhyDSSSTable_dot11ShortPreambleOptionImplemented \ | ||
1822 | (P80211DID_MKSECTION(3) | \ | ||
1823 | P80211DID_MKGROUP(5) | \ | ||
1824 | P80211DID_MKITEM(5) | 0x10000000) | ||
1825 | #define DIDmib_dot11phy_dot11PhyDSSSTable_dot11PBCCOptionImplemented \ | ||
1826 | (P80211DID_MKSECTION(3) | \ | ||
1827 | P80211DID_MKGROUP(5) | \ | ||
1828 | P80211DID_MKITEM(6) | 0x10000000) | ||
1829 | #define DIDmib_dot11phy_dot11PhyIRTable \ | ||
1830 | (P80211DID_MKSECTION(3) | \ | ||
1831 | P80211DID_MKGROUP(6)) | ||
1832 | #define DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMax \ | ||
1833 | (P80211DID_MKSECTION(3) | \ | ||
1834 | P80211DID_MKGROUP(6) | \ | ||
1835 | P80211DID_MKITEM(1) | 0x18000000) | ||
1836 | #define DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMax \ | ||
1837 | (P80211DID_MKSECTION(3) | \ | ||
1838 | P80211DID_MKGROUP(6) | \ | ||
1839 | P80211DID_MKITEM(2) | 0x18000000) | ||
1840 | #define DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMin \ | ||
1841 | (P80211DID_MKSECTION(3) | \ | ||
1842 | P80211DID_MKGROUP(6) | \ | ||
1843 | P80211DID_MKITEM(3) | 0x18000000) | ||
1844 | #define DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMin \ | ||
1845 | (P80211DID_MKSECTION(3) | \ | ||
1846 | P80211DID_MKGROUP(6) | \ | ||
1847 | P80211DID_MKITEM(4) | 0x18000000) | ||
1848 | #define DIDmib_dot11phy_dot11RegDomainsSupportedTable \ | ||
1849 | (P80211DID_MKSECTION(3) | \ | ||
1850 | P80211DID_MKGROUP(7)) | ||
1851 | #define DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportIndex \ | ||
1852 | (P80211DID_MKSECTION(3) | \ | ||
1853 | P80211DID_MKGROUP(7) | \ | ||
1854 | P80211DID_MKITEM(1) | 0x1c000000) | ||
1855 | #define DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportValue \ | ||
1856 | (P80211DID_MKSECTION(3) | \ | ||
1857 | P80211DID_MKGROUP(7) | \ | ||
1858 | P80211DID_MKITEM(2) | 0x14000000) | ||
1859 | #define DIDmib_dot11phy_dot11AntennasListTable \ | ||
1860 | (P80211DID_MKSECTION(3) | \ | ||
1861 | P80211DID_MKGROUP(8)) | ||
1862 | #define DIDmib_dot11phy_dot11AntennasListTable_dot11AntennaListIndex \ | ||
1863 | (P80211DID_MKSECTION(3) | \ | ||
1864 | P80211DID_MKGROUP(8) | \ | ||
1865 | P80211DID_MKITEM(1) | 0x1c000000) | ||
1866 | #define DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedTxAntenna \ | ||
1867 | (P80211DID_MKSECTION(3) | \ | ||
1868 | P80211DID_MKGROUP(8) | \ | ||
1869 | P80211DID_MKITEM(2) | 0x1c000000) | ||
1870 | #define DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedRxAntenna \ | ||
1871 | (P80211DID_MKSECTION(3) | \ | ||
1872 | P80211DID_MKGROUP(8) | \ | ||
1873 | P80211DID_MKITEM(3) | 0x1c000000) | ||
1874 | #define DIDmib_dot11phy_dot11AntennasListTable_dot11DiversitySelectionRx \ | ||
1875 | (P80211DID_MKSECTION(3) | \ | ||
1876 | P80211DID_MKGROUP(8) | \ | ||
1877 | P80211DID_MKITEM(4) | 0x1c000000) | ||
1878 | #define DIDmib_dot11phy_dot11SupportedDataRatesTxTable \ | ||
1879 | (P80211DID_MKSECTION(3) | \ | ||
1880 | P80211DID_MKGROUP(9)) | ||
1881 | #define DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxIndex \ | ||
1882 | (P80211DID_MKSECTION(3) | \ | ||
1883 | P80211DID_MKGROUP(9) | \ | ||
1884 | P80211DID_MKITEM(1) | 0x1c000000) | ||
1885 | #define DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxValue \ | ||
1886 | (P80211DID_MKSECTION(3) | \ | ||
1887 | P80211DID_MKGROUP(9) | \ | ||
1888 | P80211DID_MKITEM(2) | 0x14000000) | ||
1889 | #define DIDmib_dot11phy_dot11SupportedDataRatesRxTable \ | ||
1890 | (P80211DID_MKSECTION(3) | \ | ||
1891 | P80211DID_MKGROUP(10)) | ||
1892 | #define DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxIndex \ | ||
1893 | (P80211DID_MKSECTION(3) | \ | ||
1894 | P80211DID_MKGROUP(10) | \ | ||
1895 | P80211DID_MKITEM(1) | 0x1c000000) | ||
1896 | #define DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxValue \ | ||
1897 | (P80211DID_MKSECTION(3) | \ | ||
1898 | P80211DID_MKGROUP(10) | \ | ||
1899 | P80211DID_MKITEM(2) | 0x14000000) | ||
1900 | #define DIDmib_cat_lnx \ | ||
1901 | P80211DID_MKSECTION(4) | ||
1902 | #define DIDmib_lnx_lnxConfigTable \ | ||
1903 | (P80211DID_MKSECTION(4) | \ | ||
1904 | P80211DID_MKGROUP(1)) | ||
1905 | #define DIDmib_lnx_lnxConfigTable_lnxRSNAIE \ | ||
1906 | (P80211DID_MKSECTION(4) | \ | ||
1907 | P80211DID_MKGROUP(1) | \ | ||
1908 | P80211DID_MKITEM(1) | 0x18000000) | ||
1909 | #define DIDmib_cat_p2 \ | ||
1910 | P80211DID_MKSECTION(5) | ||
1911 | #define DIDmib_p2_p2Table \ | ||
1912 | (P80211DID_MKSECTION(5) | \ | ||
1913 | P80211DID_MKGROUP(1)) | ||
1914 | #define DIDmib_p2_p2Table_p2MMTx \ | ||
1915 | (P80211DID_MKSECTION(5) | \ | ||
1916 | P80211DID_MKGROUP(1) | \ | ||
1917 | P80211DID_MKITEM(1) | 0x18000000) | ||
1918 | #define DIDmib_p2_p2Table_p2EarlyBeacon \ | ||
1919 | (P80211DID_MKSECTION(5) | \ | ||
1920 | P80211DID_MKGROUP(1) | \ | ||
1921 | P80211DID_MKITEM(2) | 0x18000000) | ||
1922 | #define DIDmib_p2_p2Table_p2ReceivedFrameStatistics \ | ||
1923 | (P80211DID_MKSECTION(5) | \ | ||
1924 | P80211DID_MKGROUP(1) | \ | ||
1925 | P80211DID_MKITEM(3) | 0x10000000) | ||
1926 | #define DIDmib_p2_p2Table_p2CommunicationTallies \ | ||
1927 | (P80211DID_MKSECTION(5) | \ | ||
1928 | P80211DID_MKGROUP(1) | \ | ||
1929 | P80211DID_MKITEM(4) | 0x10000000) | ||
1930 | #define DIDmib_p2_p2Table_p2Authenticated \ | ||
1931 | (P80211DID_MKSECTION(5) | \ | ||
1932 | P80211DID_MKGROUP(1) | \ | ||
1933 | P80211DID_MKITEM(5) | 0x10000000) | ||
1934 | #define DIDmib_p2_p2Table_p2Associated \ | ||
1935 | (P80211DID_MKSECTION(5) | \ | ||
1936 | P80211DID_MKGROUP(1) | \ | ||
1937 | P80211DID_MKITEM(6) | 0x10000000) | ||
1938 | #define DIDmib_p2_p2Table_p2PowerSaveUserCount \ | ||
1939 | (P80211DID_MKSECTION(5) | \ | ||
1940 | P80211DID_MKGROUP(1) | \ | ||
1941 | P80211DID_MKITEM(7) | 0x10000000) | ||
1942 | #define DIDmib_p2_p2Table_p2Comment \ | ||
1943 | (P80211DID_MKSECTION(5) | \ | ||
1944 | P80211DID_MKGROUP(1) | \ | ||
1945 | P80211DID_MKITEM(8) | 0x18000000) | ||
1946 | #define DIDmib_p2_p2Table_p2AccessMode \ | ||
1947 | (P80211DID_MKSECTION(5) | \ | ||
1948 | P80211DID_MKGROUP(1) | \ | ||
1949 | P80211DID_MKITEM(9) | 0x18000000) | ||
1950 | #define DIDmib_p2_p2Table_p2AccessAllow \ | ||
1951 | (P80211DID_MKSECTION(5) | \ | ||
1952 | P80211DID_MKGROUP(1) | \ | ||
1953 | P80211DID_MKITEM(10) | 0x18000000) | ||
1954 | #define DIDmib_p2_p2Table_p2AccessDeny \ | ||
1955 | (P80211DID_MKSECTION(5) | \ | ||
1956 | P80211DID_MKGROUP(1) | \ | ||
1957 | P80211DID_MKITEM(11) | 0x18000000) | ||
1958 | #define DIDmib_p2_p2Table_p2ChannelInfoResults \ | ||
1959 | (P80211DID_MKSECTION(5) | \ | ||
1960 | P80211DID_MKGROUP(1) | \ | ||
1961 | P80211DID_MKITEM(12) | 0x10000000) | ||
1962 | #define DIDmib_p2_p2Static \ | ||
1963 | (P80211DID_MKSECTION(5) | \ | ||
1964 | P80211DID_MKGROUP(2)) | ||
1965 | #define DIDmib_p2_p2Static_p2CnfPortType \ | ||
1966 | (P80211DID_MKSECTION(5) | \ | ||
1967 | P80211DID_MKGROUP(2) | \ | ||
1968 | P80211DID_MKITEM(1) | 0x18000000) | ||
1969 | #define DIDmib_p2_p2Static_p2CnfOwnMACAddress \ | ||
1970 | (P80211DID_MKSECTION(5) | \ | ||
1971 | P80211DID_MKGROUP(2) | \ | ||
1972 | P80211DID_MKITEM(2) | 0x18000000) | ||
1973 | #define DIDmib_p2_p2Static_p2CnfDesiredSSID \ | ||
1974 | (P80211DID_MKSECTION(5) | \ | ||
1975 | P80211DID_MKGROUP(2) | \ | ||
1976 | P80211DID_MKITEM(3) | 0x18000000) | ||
1977 | #define DIDmib_p2_p2Static_p2CnfOwnChannel \ | ||
1978 | (P80211DID_MKSECTION(5) | \ | ||
1979 | P80211DID_MKGROUP(2) | \ | ||
1980 | P80211DID_MKITEM(4) | 0x18000000) | ||
1981 | #define DIDmib_p2_p2Static_p2CnfOwnSSID \ | ||
1982 | (P80211DID_MKSECTION(5) | \ | ||
1983 | P80211DID_MKGROUP(2) | \ | ||
1984 | P80211DID_MKITEM(5) | 0x18000000) | ||
1985 | #define DIDmib_p2_p2Static_p2CnfOwnATIMWindow \ | ||
1986 | (P80211DID_MKSECTION(5) | \ | ||
1987 | P80211DID_MKGROUP(2) | \ | ||
1988 | P80211DID_MKITEM(6) | 0x18000000) | ||
1989 | #define DIDmib_p2_p2Static_p2CnfSystemScale \ | ||
1990 | (P80211DID_MKSECTION(5) | \ | ||
1991 | P80211DID_MKGROUP(2) | \ | ||
1992 | P80211DID_MKITEM(7) | 0x18000000) | ||
1993 | #define DIDmib_p2_p2Static_p2CnfMaxDataLength \ | ||
1994 | (P80211DID_MKSECTION(5) | \ | ||
1995 | P80211DID_MKGROUP(2) | \ | ||
1996 | P80211DID_MKITEM(8) | 0x18000000) | ||
1997 | #define DIDmib_p2_p2Static_p2CnfWDSAddress \ | ||
1998 | (P80211DID_MKSECTION(5) | \ | ||
1999 | P80211DID_MKGROUP(2) | \ | ||
2000 | P80211DID_MKITEM(9) | 0x18000000) | ||
2001 | #define DIDmib_p2_p2Static_p2CnfPMEnabled \ | ||
2002 | (P80211DID_MKSECTION(5) | \ | ||
2003 | P80211DID_MKGROUP(2) | \ | ||
2004 | P80211DID_MKITEM(10) | 0x18000000) | ||
2005 | #define DIDmib_p2_p2Static_p2CnfPMEPS \ | ||
2006 | (P80211DID_MKSECTION(5) | \ | ||
2007 | P80211DID_MKGROUP(2) | \ | ||
2008 | P80211DID_MKITEM(11) | 0x18000000) | ||
2009 | #define DIDmib_p2_p2Static_p2CnfMulticastReceive \ | ||
2010 | (P80211DID_MKSECTION(5) | \ | ||
2011 | P80211DID_MKGROUP(2) | \ | ||
2012 | P80211DID_MKITEM(12) | 0x18000000) | ||
2013 | #define DIDmib_p2_p2Static_p2CnfMaxSleepDuration \ | ||
2014 | (P80211DID_MKSECTION(5) | \ | ||
2015 | P80211DID_MKGROUP(2) | \ | ||
2016 | P80211DID_MKITEM(13) | 0x18000000) | ||
2017 | #define DIDmib_p2_p2Static_p2CnfPMHoldoverDuration \ | ||
2018 | (P80211DID_MKSECTION(5) | \ | ||
2019 | P80211DID_MKGROUP(2) | \ | ||
2020 | P80211DID_MKITEM(14) | 0x18000000) | ||
2021 | #define DIDmib_p2_p2Static_p2CnfOwnName \ | ||
2022 | (P80211DID_MKSECTION(5) | \ | ||
2023 | P80211DID_MKGROUP(2) | \ | ||
2024 | P80211DID_MKITEM(15) | 0x18000000) | ||
2025 | #define DIDmib_p2_p2Static_p2CnfOwnDTIMPeriod \ | ||
2026 | (P80211DID_MKSECTION(5) | \ | ||
2027 | P80211DID_MKGROUP(2) | \ | ||
2028 | P80211DID_MKITEM(16) | 0x18000000) | ||
2029 | #define DIDmib_p2_p2Static_p2CnfWDSAddress1 \ | ||
2030 | (P80211DID_MKSECTION(5) | \ | ||
2031 | P80211DID_MKGROUP(2) | \ | ||
2032 | P80211DID_MKITEM(17) | 0x18000000) | ||
2033 | #define DIDmib_p2_p2Static_p2CnfWDSAddress2 \ | ||
2034 | (P80211DID_MKSECTION(5) | \ | ||
2035 | P80211DID_MKGROUP(2) | \ | ||
2036 | P80211DID_MKITEM(18) | 0x18000000) | ||
2037 | #define DIDmib_p2_p2Static_p2CnfWDSAddress3 \ | ||
2038 | (P80211DID_MKSECTION(5) | \ | ||
2039 | P80211DID_MKGROUP(2) | \ | ||
2040 | P80211DID_MKITEM(19) | 0x18000000) | ||
2041 | #define DIDmib_p2_p2Static_p2CnfWDSAddress4 \ | ||
2042 | (P80211DID_MKSECTION(5) | \ | ||
2043 | P80211DID_MKGROUP(2) | \ | ||
2044 | P80211DID_MKITEM(20) | 0x18000000) | ||
2045 | #define DIDmib_p2_p2Static_p2CnfWDSAddress5 \ | ||
2046 | (P80211DID_MKSECTION(5) | \ | ||
2047 | P80211DID_MKGROUP(2) | \ | ||
2048 | P80211DID_MKITEM(21) | 0x18000000) | ||
2049 | #define DIDmib_p2_p2Static_p2CnfWDSAddress6 \ | ||
2050 | (P80211DID_MKSECTION(5) | \ | ||
2051 | P80211DID_MKGROUP(2) | \ | ||
2052 | P80211DID_MKITEM(22) | 0x18000000) | ||
2053 | #define DIDmib_p2_p2Static_p2CnfMulticastPMBuffering \ | ||
2054 | (P80211DID_MKSECTION(5) | \ | ||
2055 | P80211DID_MKGROUP(2) | \ | ||
2056 | P80211DID_MKITEM(23) | 0x18000000) | ||
2057 | #define DIDmib_p2_p2Static_p2CnfWEPDefaultKeyID \ | ||
2058 | (P80211DID_MKSECTION(5) | \ | ||
2059 | P80211DID_MKGROUP(2) | \ | ||
2060 | P80211DID_MKITEM(24) | 0x18000000) | ||
2061 | #define DIDmib_p2_p2Static_p2CnfWEPDefaultKey0 \ | ||
2062 | (P80211DID_MKSECTION(5) | \ | ||
2063 | P80211DID_MKGROUP(2) | \ | ||
2064 | P80211DID_MKITEM(25) | 0x08000000) | ||
2065 | #define DIDmib_p2_p2Static_p2CnfWEPDefaultKey1 \ | ||
2066 | (P80211DID_MKSECTION(5) | \ | ||
2067 | P80211DID_MKGROUP(2) | \ | ||
2068 | P80211DID_MKITEM(26) | 0x08000000) | ||
2069 | #define DIDmib_p2_p2Static_p2CnfWEPDefaultKey2 \ | ||
2070 | (P80211DID_MKSECTION(5) | \ | ||
2071 | P80211DID_MKGROUP(2) | \ | ||
2072 | P80211DID_MKITEM(27) | 0x08000000) | ||
2073 | #define DIDmib_p2_p2Static_p2CnfWEPDefaultKey3 \ | ||
2074 | (P80211DID_MKSECTION(5) | \ | ||
2075 | P80211DID_MKGROUP(2) | \ | ||
2076 | P80211DID_MKITEM(28) | 0x08000000) | ||
2077 | #define DIDmib_p2_p2Static_p2CnfWEPFlags \ | ||
2078 | (P80211DID_MKSECTION(5) | \ | ||
2079 | P80211DID_MKGROUP(2) | \ | ||
2080 | P80211DID_MKITEM(29) | 0x18000000) | ||
2081 | #define DIDmib_p2_p2Static_p2CnfAuthentication \ | ||
2082 | (P80211DID_MKSECTION(5) | \ | ||
2083 | P80211DID_MKGROUP(2) | \ | ||
2084 | P80211DID_MKITEM(30) | 0x18000000) | ||
2085 | #define DIDmib_p2_p2Static_p2CnfMaxAssociatedStations \ | ||
2086 | (P80211DID_MKSECTION(5) | \ | ||
2087 | P80211DID_MKGROUP(2) | \ | ||
2088 | P80211DID_MKITEM(31) | 0x18000000) | ||
2089 | #define DIDmib_p2_p2Static_p2CnfTxControl \ | ||
2090 | (P80211DID_MKSECTION(5) | \ | ||
2091 | P80211DID_MKGROUP(2) | \ | ||
2092 | P80211DID_MKITEM(32) | 0x18000000) | ||
2093 | #define DIDmib_p2_p2Static_p2CnfRoamingMode \ | ||
2094 | (P80211DID_MKSECTION(5) | \ | ||
2095 | P80211DID_MKGROUP(2) | \ | ||
2096 | P80211DID_MKITEM(33) | 0x18000000) | ||
2097 | #define DIDmib_p2_p2Static_p2CnfHostAuthentication \ | ||
2098 | (P80211DID_MKSECTION(5) | \ | ||
2099 | P80211DID_MKGROUP(2) | \ | ||
2100 | P80211DID_MKITEM(34) | 0x18000000) | ||
2101 | #define DIDmib_p2_p2Static_p2CnfRcvCrcError \ | ||
2102 | (P80211DID_MKSECTION(5) | \ | ||
2103 | P80211DID_MKGROUP(2) | \ | ||
2104 | P80211DID_MKITEM(35) | 0x18000000) | ||
2105 | #define DIDmib_p2_p2Static_p2CnfAltRetryCount \ | ||
2106 | (P80211DID_MKSECTION(5) | \ | ||
2107 | P80211DID_MKGROUP(2) | \ | ||
2108 | P80211DID_MKITEM(36) | 0x18000000) | ||
2109 | #define DIDmib_p2_p2Static_p2CnfBeaconInterval \ | ||
2110 | (P80211DID_MKSECTION(5) | \ | ||
2111 | P80211DID_MKGROUP(2) | \ | ||
2112 | P80211DID_MKITEM(37) | 0x18000000) | ||
2113 | #define DIDmib_p2_p2Static_p2CnfMediumOccupancyLimit \ | ||
2114 | (P80211DID_MKSECTION(5) | \ | ||
2115 | P80211DID_MKGROUP(2) | \ | ||
2116 | P80211DID_MKITEM(38) | 0x18000000) | ||
2117 | #define DIDmib_p2_p2Static_p2CnfCFPPeriod \ | ||
2118 | (P80211DID_MKSECTION(5) | \ | ||
2119 | P80211DID_MKGROUP(2) | \ | ||
2120 | P80211DID_MKITEM(39) | 0x18000000) | ||
2121 | #define DIDmib_p2_p2Static_p2CnfCFPMaxDuration \ | ||
2122 | (P80211DID_MKSECTION(5) | \ | ||
2123 | P80211DID_MKGROUP(2) | \ | ||
2124 | P80211DID_MKITEM(40) | 0x18000000) | ||
2125 | #define DIDmib_p2_p2Static_p2CnfCFPFlags \ | ||
2126 | (P80211DID_MKSECTION(5) | \ | ||
2127 | P80211DID_MKGROUP(2) | \ | ||
2128 | P80211DID_MKITEM(41) | 0x18000000) | ||
2129 | #define DIDmib_p2_p2Static_p2CnfSTAPCFInfo \ | ||
2130 | (P80211DID_MKSECTION(5) | \ | ||
2131 | P80211DID_MKGROUP(2) | \ | ||
2132 | P80211DID_MKITEM(42) | 0x18000000) | ||
2133 | #define DIDmib_p2_p2Static_p2CnfPriorityQUsage \ | ||
2134 | (P80211DID_MKSECTION(5) | \ | ||
2135 | P80211DID_MKGROUP(2) | \ | ||
2136 | P80211DID_MKITEM(43) | 0x18000000) | ||
2137 | #define DIDmib_p2_p2Static_p2CnfTIMCtrl \ | ||
2138 | (P80211DID_MKSECTION(5) | \ | ||
2139 | P80211DID_MKGROUP(2) | \ | ||
2140 | P80211DID_MKITEM(44) | 0x18000000) | ||
2141 | #define DIDmib_p2_p2Static_p2CnfThirty2Tally \ | ||
2142 | (P80211DID_MKSECTION(5) | \ | ||
2143 | P80211DID_MKGROUP(2) | \ | ||
2144 | P80211DID_MKITEM(45) | 0x18000000) | ||
2145 | #define DIDmib_p2_p2Static_p2CnfEnhSecurity \ | ||
2146 | (P80211DID_MKSECTION(5) | \ | ||
2147 | P80211DID_MKGROUP(2) | \ | ||
2148 | P80211DID_MKITEM(46) | 0x18000000) | ||
2149 | #define DIDmib_p2_p2Static_p2CnfShortPreamble \ | ||
2150 | (P80211DID_MKSECTION(5) | \ | ||
2151 | P80211DID_MKGROUP(2) | \ | ||
2152 | P80211DID_MKITEM(47) | 0x18000000) | ||
2153 | #define DIDmib_p2_p2Static_p2CnfExcludeLongPreamble \ | ||
2154 | (P80211DID_MKSECTION(5) | \ | ||
2155 | P80211DID_MKGROUP(2) | \ | ||
2156 | P80211DID_MKITEM(48) | 0x18000000) | ||
2157 | #define DIDmib_p2_p2Static_p2CnfAuthenticationRspTO \ | ||
2158 | (P80211DID_MKSECTION(5) | \ | ||
2159 | P80211DID_MKGROUP(2) | \ | ||
2160 | P80211DID_MKITEM(49) | 0x18000000) | ||
2161 | #define DIDmib_p2_p2Static_p2CnfBasicRates \ | ||
2162 | (P80211DID_MKSECTION(5) | \ | ||
2163 | P80211DID_MKGROUP(2) | \ | ||
2164 | P80211DID_MKITEM(50) | 0x18000000) | ||
2165 | #define DIDmib_p2_p2Static_p2CnfSupportedRates \ | ||
2166 | (P80211DID_MKSECTION(5) | \ | ||
2167 | P80211DID_MKGROUP(2) | \ | ||
2168 | P80211DID_MKITEM(51) | 0x18000000) | ||
2169 | #define DIDmib_p2_p2Dynamic \ | ||
2170 | (P80211DID_MKSECTION(5) | \ | ||
2171 | P80211DID_MKGROUP(3)) | ||
2172 | #define DIDmib_p2_p2Dynamic_p2CreateIBSS \ | ||
2173 | (P80211DID_MKSECTION(5) | \ | ||
2174 | P80211DID_MKGROUP(3) | \ | ||
2175 | P80211DID_MKITEM(1) | 0x18000000) | ||
2176 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold \ | ||
2177 | (P80211DID_MKSECTION(5) | \ | ||
2178 | P80211DID_MKGROUP(3) | \ | ||
2179 | P80211DID_MKITEM(2) | 0x18000000) | ||
2180 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold \ | ||
2181 | (P80211DID_MKSECTION(5) | \ | ||
2182 | P80211DID_MKGROUP(3) | \ | ||
2183 | P80211DID_MKITEM(3) | 0x18000000) | ||
2184 | #define DIDmib_p2_p2Dynamic_p2TxRateControl \ | ||
2185 | (P80211DID_MKSECTION(5) | \ | ||
2186 | P80211DID_MKGROUP(3) | \ | ||
2187 | P80211DID_MKITEM(4) | 0x18000000) | ||
2188 | #define DIDmib_p2_p2Dynamic_p2PromiscuousMode \ | ||
2189 | (P80211DID_MKSECTION(5) | \ | ||
2190 | P80211DID_MKGROUP(3) | \ | ||
2191 | P80211DID_MKITEM(5) | 0x18000000) | ||
2192 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold0 \ | ||
2193 | (P80211DID_MKSECTION(5) | \ | ||
2194 | P80211DID_MKGROUP(3) | \ | ||
2195 | P80211DID_MKITEM(6) | 0x18000000) | ||
2196 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold1 \ | ||
2197 | (P80211DID_MKSECTION(5) | \ | ||
2198 | P80211DID_MKGROUP(3) | \ | ||
2199 | P80211DID_MKITEM(7) | 0x18000000) | ||
2200 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold2 \ | ||
2201 | (P80211DID_MKSECTION(5) | \ | ||
2202 | P80211DID_MKGROUP(3) | \ | ||
2203 | P80211DID_MKITEM(8) | 0x18000000) | ||
2204 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold3 \ | ||
2205 | (P80211DID_MKSECTION(5) | \ | ||
2206 | P80211DID_MKGROUP(3) | \ | ||
2207 | P80211DID_MKITEM(9) | 0x18000000) | ||
2208 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold4 \ | ||
2209 | (P80211DID_MKSECTION(5) | \ | ||
2210 | P80211DID_MKGROUP(3) | \ | ||
2211 | P80211DID_MKITEM(10) | 0x18000000) | ||
2212 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold5 \ | ||
2213 | (P80211DID_MKSECTION(5) | \ | ||
2214 | P80211DID_MKGROUP(3) | \ | ||
2215 | P80211DID_MKITEM(11) | 0x18000000) | ||
2216 | #define DIDmib_p2_p2Dynamic_p2FragmentationThreshold6 \ | ||
2217 | (P80211DID_MKSECTION(5) | \ | ||
2218 | P80211DID_MKGROUP(3) | \ | ||
2219 | P80211DID_MKITEM(12) | 0x18000000) | ||
2220 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold0 \ | ||
2221 | (P80211DID_MKSECTION(5) | \ | ||
2222 | P80211DID_MKGROUP(3) | \ | ||
2223 | P80211DID_MKITEM(13) | 0x18000000) | ||
2224 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold1 \ | ||
2225 | (P80211DID_MKSECTION(5) | \ | ||
2226 | P80211DID_MKGROUP(3) | \ | ||
2227 | P80211DID_MKITEM(14) | 0x18000000) | ||
2228 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold2 \ | ||
2229 | (P80211DID_MKSECTION(5) | \ | ||
2230 | P80211DID_MKGROUP(3) | \ | ||
2231 | P80211DID_MKITEM(15) | 0x18000000) | ||
2232 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold3 \ | ||
2233 | (P80211DID_MKSECTION(5) | \ | ||
2234 | P80211DID_MKGROUP(3) | \ | ||
2235 | P80211DID_MKITEM(16) | 0x18000000) | ||
2236 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold4 \ | ||
2237 | (P80211DID_MKSECTION(5) | \ | ||
2238 | P80211DID_MKGROUP(3) | \ | ||
2239 | P80211DID_MKITEM(17) | 0x18000000) | ||
2240 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold5 \ | ||
2241 | (P80211DID_MKSECTION(5) | \ | ||
2242 | P80211DID_MKGROUP(3) | \ | ||
2243 | P80211DID_MKITEM(18) | 0x18000000) | ||
2244 | #define DIDmib_p2_p2Dynamic_p2RTSThreshold6 \ | ||
2245 | (P80211DID_MKSECTION(5) | \ | ||
2246 | P80211DID_MKGROUP(3) | \ | ||
2247 | P80211DID_MKITEM(19) | 0x18000000) | ||
2248 | #define DIDmib_p2_p2Dynamic_p2TxRateControl0 \ | ||
2249 | (P80211DID_MKSECTION(5) | \ | ||
2250 | P80211DID_MKGROUP(3) | \ | ||
2251 | P80211DID_MKITEM(20) | 0x18000000) | ||
2252 | #define DIDmib_p2_p2Dynamic_p2TxRateControl1 \ | ||
2253 | (P80211DID_MKSECTION(5) | \ | ||
2254 | P80211DID_MKGROUP(3) | \ | ||
2255 | P80211DID_MKITEM(21) | 0x18000000) | ||
2256 | #define DIDmib_p2_p2Dynamic_p2TxRateControl2 \ | ||
2257 | (P80211DID_MKSECTION(5) | \ | ||
2258 | P80211DID_MKGROUP(3) | \ | ||
2259 | P80211DID_MKITEM(22) | 0x18000000) | ||
2260 | #define DIDmib_p2_p2Dynamic_p2TxRateControl3 \ | ||
2261 | (P80211DID_MKSECTION(5) | \ | ||
2262 | P80211DID_MKGROUP(3) | \ | ||
2263 | P80211DID_MKITEM(23) | 0x18000000) | ||
2264 | #define DIDmib_p2_p2Dynamic_p2TxRateControl4 \ | ||
2265 | (P80211DID_MKSECTION(5) | \ | ||
2266 | P80211DID_MKGROUP(3) | \ | ||
2267 | P80211DID_MKITEM(24) | 0x18000000) | ||
2268 | #define DIDmib_p2_p2Dynamic_p2TxRateControl5 \ | ||
2269 | (P80211DID_MKSECTION(5) | \ | ||
2270 | P80211DID_MKGROUP(3) | \ | ||
2271 | P80211DID_MKITEM(25) | 0x18000000) | ||
2272 | #define DIDmib_p2_p2Dynamic_p2TxRateControl6 \ | ||
2273 | (P80211DID_MKSECTION(5) | \ | ||
2274 | P80211DID_MKGROUP(3) | \ | ||
2275 | P80211DID_MKITEM(26) | 0x18000000) | ||
2276 | #define DIDmib_p2_p2Behavior \ | ||
2277 | (P80211DID_MKSECTION(5) | \ | ||
2278 | P80211DID_MKGROUP(4)) | ||
2279 | #define DIDmib_p2_p2Behavior_p2TickTime \ | ||
2280 | (P80211DID_MKSECTION(5) | \ | ||
2281 | P80211DID_MKGROUP(4) | \ | ||
2282 | P80211DID_MKITEM(1) | 0x18000000) | ||
2283 | #define DIDmib_p2_p2NIC \ | ||
2284 | (P80211DID_MKSECTION(5) | \ | ||
2285 | P80211DID_MKGROUP(5)) | ||
2286 | #define DIDmib_p2_p2NIC_p2MaxLoadTime \ | ||
2287 | (P80211DID_MKSECTION(5) | \ | ||
2288 | P80211DID_MKGROUP(5) | \ | ||
2289 | P80211DID_MKITEM(1) | 0x10000000) | ||
2290 | #define DIDmib_p2_p2NIC_p2DLBufferPage \ | ||
2291 | (P80211DID_MKSECTION(5) | \ | ||
2292 | P80211DID_MKGROUP(5) | \ | ||
2293 | P80211DID_MKITEM(2) | 0x10000000) | ||
2294 | #define DIDmib_p2_p2NIC_p2DLBufferOffset \ | ||
2295 | (P80211DID_MKSECTION(5) | \ | ||
2296 | P80211DID_MKGROUP(5) | \ | ||
2297 | P80211DID_MKITEM(3) | 0x10000000) | ||
2298 | #define DIDmib_p2_p2NIC_p2DLBufferLength \ | ||
2299 | (P80211DID_MKSECTION(5) | \ | ||
2300 | P80211DID_MKGROUP(5) | \ | ||
2301 | P80211DID_MKITEM(4) | 0x10000000) | ||
2302 | #define DIDmib_p2_p2NIC_p2PRIIdentity \ | ||
2303 | (P80211DID_MKSECTION(5) | \ | ||
2304 | P80211DID_MKGROUP(5) | \ | ||
2305 | P80211DID_MKITEM(5) | 0x10000000) | ||
2306 | #define DIDmib_p2_p2NIC_p2PRISupRange \ | ||
2307 | (P80211DID_MKSECTION(5) | \ | ||
2308 | P80211DID_MKGROUP(5) | \ | ||
2309 | P80211DID_MKITEM(6) | 0x10000000) | ||
2310 | #define DIDmib_p2_p2NIC_p2CFIActRanges \ | ||
2311 | (P80211DID_MKSECTION(5) | \ | ||
2312 | P80211DID_MKGROUP(5) | \ | ||
2313 | P80211DID_MKITEM(7) | 0x10000000) | ||
2314 | #define DIDmib_p2_p2NIC_p2NICSerialNumber \ | ||
2315 | (P80211DID_MKSECTION(5) | \ | ||
2316 | P80211DID_MKGROUP(5) | \ | ||
2317 | P80211DID_MKITEM(8) | 0x10000000) | ||
2318 | #define DIDmib_p2_p2NIC_p2NICIdentity \ | ||
2319 | (P80211DID_MKSECTION(5) | \ | ||
2320 | P80211DID_MKGROUP(5) | \ | ||
2321 | P80211DID_MKITEM(9) | 0x10000000) | ||
2322 | #define DIDmib_p2_p2NIC_p2MFISupRange \ | ||
2323 | (P80211DID_MKSECTION(5) | \ | ||
2324 | P80211DID_MKGROUP(5) | \ | ||
2325 | P80211DID_MKITEM(10) | 0x10000000) | ||
2326 | #define DIDmib_p2_p2NIC_p2CFISupRange \ | ||
2327 | (P80211DID_MKSECTION(5) | \ | ||
2328 | P80211DID_MKGROUP(5) | \ | ||
2329 | P80211DID_MKITEM(11) | 0x10000000) | ||
2330 | #define DIDmib_p2_p2NIC_p2ChannelList \ | ||
2331 | (P80211DID_MKSECTION(5) | \ | ||
2332 | P80211DID_MKGROUP(5) | \ | ||
2333 | P80211DID_MKITEM(12) | 0x10000000) | ||
2334 | #define DIDmib_p2_p2NIC_p2RegulatoryDomains \ | ||
2335 | (P80211DID_MKSECTION(5) | \ | ||
2336 | P80211DID_MKGROUP(5) | \ | ||
2337 | P80211DID_MKITEM(13) | 0x10000000) | ||
2338 | #define DIDmib_p2_p2NIC_p2TempType \ | ||
2339 | (P80211DID_MKSECTION(5) | \ | ||
2340 | P80211DID_MKGROUP(5) | \ | ||
2341 | P80211DID_MKITEM(14) | 0x10000000) | ||
2342 | #define DIDmib_p2_p2NIC_p2STAIdentity \ | ||
2343 | (P80211DID_MKSECTION(5) | \ | ||
2344 | P80211DID_MKGROUP(5) | \ | ||
2345 | P80211DID_MKITEM(15) | 0x10000000) | ||
2346 | #define DIDmib_p2_p2NIC_p2STASupRange \ | ||
2347 | (P80211DID_MKSECTION(5) | \ | ||
2348 | P80211DID_MKGROUP(5) | \ | ||
2349 | P80211DID_MKITEM(16) | 0x10000000) | ||
2350 | #define DIDmib_p2_p2NIC_p2MFIActRanges \ | ||
2351 | (P80211DID_MKSECTION(5) | \ | ||
2352 | P80211DID_MKGROUP(5) | \ | ||
2353 | P80211DID_MKITEM(17) | 0x10000000) | ||
2354 | #define DIDmib_p2_p2NIC_p2STACFIActRanges \ | ||
2355 | (P80211DID_MKSECTION(5) | \ | ||
2356 | P80211DID_MKGROUP(5) | \ | ||
2357 | P80211DID_MKITEM(18) | 0x10000000) | ||
2358 | #define DIDmib_p2_p2NIC_p2BuildSequence \ | ||
2359 | (P80211DID_MKSECTION(5) | \ | ||
2360 | P80211DID_MKGROUP(5) | \ | ||
2361 | P80211DID_MKITEM(19) | 0x10000000) | ||
2362 | #define DIDmib_p2_p2NIC_p2PrimaryFWID \ | ||
2363 | (P80211DID_MKSECTION(5) | \ | ||
2364 | P80211DID_MKGROUP(5) | \ | ||
2365 | P80211DID_MKITEM(20) | 0x10000000) | ||
2366 | #define DIDmib_p2_p2NIC_p2SecondaryFWID \ | ||
2367 | (P80211DID_MKSECTION(5) | \ | ||
2368 | P80211DID_MKGROUP(5) | \ | ||
2369 | P80211DID_MKITEM(21) | 0x10000000) | ||
2370 | #define DIDmib_p2_p2NIC_p2TertiaryFWID \ | ||
2371 | (P80211DID_MKSECTION(5) | \ | ||
2372 | P80211DID_MKGROUP(5) | \ | ||
2373 | P80211DID_MKITEM(22) | 0x10000000) | ||
2374 | #define DIDmib_p2_p2MAC \ | ||
2375 | (P80211DID_MKSECTION(5) | \ | ||
2376 | P80211DID_MKGROUP(6)) | ||
2377 | #define DIDmib_p2_p2MAC_p2PortStatus \ | ||
2378 | (P80211DID_MKSECTION(5) | \ | ||
2379 | P80211DID_MKGROUP(6) | \ | ||
2380 | P80211DID_MKITEM(1) | 0x10000000) | ||
2381 | #define DIDmib_p2_p2MAC_p2CurrentSSID \ | ||
2382 | (P80211DID_MKSECTION(5) | \ | ||
2383 | P80211DID_MKGROUP(6) | \ | ||
2384 | P80211DID_MKITEM(2) | 0x10000000) | ||
2385 | #define DIDmib_p2_p2MAC_p2CurrentBSSID \ | ||
2386 | (P80211DID_MKSECTION(5) | \ | ||
2387 | P80211DID_MKGROUP(6) | \ | ||
2388 | P80211DID_MKITEM(3) | 0x10000000) | ||
2389 | #define DIDmib_p2_p2MAC_p2CommsQuality \ | ||
2390 | (P80211DID_MKSECTION(5) | \ | ||
2391 | P80211DID_MKGROUP(6) | \ | ||
2392 | P80211DID_MKITEM(4) | 0x10000000) | ||
2393 | #define DIDmib_p2_p2MAC_p2CommsQualityCQ \ | ||
2394 | (P80211DID_MKSECTION(5) | \ | ||
2395 | P80211DID_MKGROUP(6) | \ | ||
2396 | P80211DID_MKITEM(5) | 0x10000000) | ||
2397 | #define DIDmib_p2_p2MAC_p2CommsQualityASL \ | ||
2398 | (P80211DID_MKSECTION(5) | \ | ||
2399 | P80211DID_MKGROUP(6) | \ | ||
2400 | P80211DID_MKITEM(6) | 0x10000000) | ||
2401 | #define DIDmib_p2_p2MAC_p2CommsQualityANL \ | ||
2402 | (P80211DID_MKSECTION(5) | \ | ||
2403 | P80211DID_MKGROUP(6) | \ | ||
2404 | P80211DID_MKITEM(7) | 0x10000000) | ||
2405 | #define DIDmib_p2_p2MAC_p2dbmCommsQuality \ | ||
2406 | (P80211DID_MKSECTION(5) | \ | ||
2407 | P80211DID_MKGROUP(6) | \ | ||
2408 | P80211DID_MKITEM(8) | 0x10000000) | ||
2409 | #define DIDmib_p2_p2MAC_p2dbmCommsQualityCQ \ | ||
2410 | (P80211DID_MKSECTION(5) | \ | ||
2411 | P80211DID_MKGROUP(6) | \ | ||
2412 | P80211DID_MKITEM(9) | 0x10000000) | ||
2413 | #define DIDmib_p2_p2MAC_p2dbmCommsQualityASL \ | ||
2414 | (P80211DID_MKSECTION(5) | \ | ||
2415 | P80211DID_MKGROUP(6) | \ | ||
2416 | P80211DID_MKITEM(10) | 0x10000000) | ||
2417 | #define DIDmib_p2_p2MAC_p2dbmCommsQualityANL \ | ||
2418 | (P80211DID_MKSECTION(5) | \ | ||
2419 | P80211DID_MKGROUP(6) | \ | ||
2420 | P80211DID_MKITEM(11) | 0x10000000) | ||
2421 | #define DIDmib_p2_p2MAC_p2CurrentTxRate \ | ||
2422 | (P80211DID_MKSECTION(5) | \ | ||
2423 | P80211DID_MKGROUP(6) | \ | ||
2424 | P80211DID_MKITEM(12) | 0x10000000) | ||
2425 | #define DIDmib_p2_p2MAC_p2CurrentBeaconInterval \ | ||
2426 | (P80211DID_MKSECTION(5) | \ | ||
2427 | P80211DID_MKGROUP(6) | \ | ||
2428 | P80211DID_MKITEM(13) | 0x10000000) | ||
2429 | #define DIDmib_p2_p2MAC_p2StaCurrentScaleThresholds \ | ||
2430 | (P80211DID_MKSECTION(5) | \ | ||
2431 | P80211DID_MKGROUP(6) | \ | ||
2432 | P80211DID_MKITEM(14) | 0x10000000) | ||
2433 | #define DIDmib_p2_p2MAC_p2APCurrentScaleThresholds \ | ||
2434 | (P80211DID_MKSECTION(5) | \ | ||
2435 | P80211DID_MKGROUP(6) | \ | ||
2436 | P80211DID_MKITEM(15) | 0x10000000) | ||
2437 | #define DIDmib_p2_p2MAC_p2ProtocolRspTime \ | ||
2438 | (P80211DID_MKSECTION(5) | \ | ||
2439 | P80211DID_MKGROUP(6) | \ | ||
2440 | P80211DID_MKITEM(16) | 0x10000000) | ||
2441 | #define DIDmib_p2_p2MAC_p2ShortRetryLimit \ | ||
2442 | (P80211DID_MKSECTION(5) | \ | ||
2443 | P80211DID_MKGROUP(6) | \ | ||
2444 | P80211DID_MKITEM(17) | 0x10000000) | ||
2445 | #define DIDmib_p2_p2MAC_p2LongRetryLimit \ | ||
2446 | (P80211DID_MKSECTION(5) | \ | ||
2447 | P80211DID_MKGROUP(6) | \ | ||
2448 | P80211DID_MKITEM(18) | 0x10000000) | ||
2449 | #define DIDmib_p2_p2MAC_p2MaxTransmitLifetime \ | ||
2450 | (P80211DID_MKSECTION(5) | \ | ||
2451 | P80211DID_MKGROUP(6) | \ | ||
2452 | P80211DID_MKITEM(19) | 0x10000000) | ||
2453 | #define DIDmib_p2_p2MAC_p2MaxReceiveLifetime \ | ||
2454 | (P80211DID_MKSECTION(5) | \ | ||
2455 | P80211DID_MKGROUP(6) | \ | ||
2456 | P80211DID_MKITEM(20) | 0x10000000) | ||
2457 | #define DIDmib_p2_p2MAC_p2CFPollable \ | ||
2458 | (P80211DID_MKSECTION(5) | \ | ||
2459 | P80211DID_MKGROUP(6) | \ | ||
2460 | P80211DID_MKITEM(21) | 0x10000000) | ||
2461 | #define DIDmib_p2_p2MAC_p2AuthenticationAlgorithms \ | ||
2462 | (P80211DID_MKSECTION(5) | \ | ||
2463 | P80211DID_MKGROUP(6) | \ | ||
2464 | P80211DID_MKITEM(22) | 0x10000000) | ||
2465 | #define DIDmib_p2_p2MAC_p2PrivacyOptionImplemented \ | ||
2466 | (P80211DID_MKSECTION(5) | \ | ||
2467 | P80211DID_MKGROUP(6) | \ | ||
2468 | P80211DID_MKITEM(23) | 0x10000000) | ||
2469 | #define DIDmib_p2_p2MAC_p2CurrentTxRate1 \ | ||
2470 | (P80211DID_MKSECTION(5) | \ | ||
2471 | P80211DID_MKGROUP(6) | \ | ||
2472 | P80211DID_MKITEM(24) | 0x10000000) | ||
2473 | #define DIDmib_p2_p2MAC_p2CurrentTxRate2 \ | ||
2474 | (P80211DID_MKSECTION(5) | \ | ||
2475 | P80211DID_MKGROUP(6) | \ | ||
2476 | P80211DID_MKITEM(25) | 0x10000000) | ||
2477 | #define DIDmib_p2_p2MAC_p2CurrentTxRate3 \ | ||
2478 | (P80211DID_MKSECTION(5) | \ | ||
2479 | P80211DID_MKGROUP(6) | \ | ||
2480 | P80211DID_MKITEM(26) | 0x10000000) | ||
2481 | #define DIDmib_p2_p2MAC_p2CurrentTxRate4 \ | ||
2482 | (P80211DID_MKSECTION(5) | \ | ||
2483 | P80211DID_MKGROUP(6) | \ | ||
2484 | P80211DID_MKITEM(27) | 0x10000000) | ||
2485 | #define DIDmib_p2_p2MAC_p2CurrentTxRate5 \ | ||
2486 | (P80211DID_MKSECTION(5) | \ | ||
2487 | P80211DID_MKGROUP(6) | \ | ||
2488 | P80211DID_MKITEM(28) | 0x10000000) | ||
2489 | #define DIDmib_p2_p2MAC_p2CurrentTxRate6 \ | ||
2490 | (P80211DID_MKSECTION(5) | \ | ||
2491 | P80211DID_MKGROUP(6) | \ | ||
2492 | P80211DID_MKITEM(29) | 0x10000000) | ||
2493 | #define DIDmib_p2_p2MAC_p2OwnMACAddress \ | ||
2494 | (P80211DID_MKSECTION(5) | \ | ||
2495 | P80211DID_MKGROUP(6) | \ | ||
2496 | P80211DID_MKITEM(30) | 0x10000000) | ||
2497 | #define DIDmib_p2_p2Modem \ | ||
2498 | (P80211DID_MKSECTION(5) | \ | ||
2499 | P80211DID_MKGROUP(7)) | ||
2500 | #define DIDmib_p2_p2Modem_p2PHYType \ | ||
2501 | (P80211DID_MKSECTION(5) | \ | ||
2502 | P80211DID_MKGROUP(7) | \ | ||
2503 | P80211DID_MKITEM(1) | 0x10000000) | ||
2504 | #define DIDmib_p2_p2Modem_p2CurrentChannel \ | ||
2505 | (P80211DID_MKSECTION(5) | \ | ||
2506 | P80211DID_MKGROUP(7) | \ | ||
2507 | P80211DID_MKITEM(2) | 0x10000000) | ||
2508 | #define DIDmib_p2_p2Modem_p2CurrentPowerState \ | ||
2509 | (P80211DID_MKSECTION(5) | \ | ||
2510 | P80211DID_MKGROUP(7) | \ | ||
2511 | P80211DID_MKITEM(3) | 0x10000000) | ||
2512 | #define DIDmib_p2_p2Modem_p2CCAMode \ | ||
2513 | (P80211DID_MKSECTION(5) | \ | ||
2514 | P80211DID_MKGROUP(7) | \ | ||
2515 | P80211DID_MKITEM(4) | 0x10000000) | ||
2516 | #define DIDmib_p2_p2Modem_p2SupportedDataRates \ | ||
2517 | (P80211DID_MKSECTION(5) | \ | ||
2518 | P80211DID_MKGROUP(7) | \ | ||
2519 | P80211DID_MKITEM(5) | 0x10000000) | ||
2520 | #define DIDmib_p2_p2Modem_p2TxPowerMax \ | ||
2521 | (P80211DID_MKSECTION(5) | \ | ||
2522 | P80211DID_MKGROUP(7) | \ | ||
2523 | P80211DID_MKITEM(6) | 0x18000000) | ||
2524 | #endif | ||
diff --git a/drivers/staging/wlan-ng/p80211metamib.h b/drivers/staging/wlan-ng/p80211metamib.h new file mode 100644 index 000000000000..19867fd314eb --- /dev/null +++ b/drivers/staging/wlan-ng/p80211metamib.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* p80211metamib.h | ||
2 | * | ||
3 | * Macros, const, types, and funcs for p80211 mib metadata | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares some of the constants and types used in various | ||
48 | * parts of the linux-wlan system. | ||
49 | * | ||
50 | * Notes: | ||
51 | * - Constant values are always in HOST byte order. | ||
52 | * | ||
53 | * All functions and statics declared here are implemented in p80211types.c | ||
54 | * -------------------------------------------------------------------- | ||
55 | */ | ||
56 | |||
57 | #ifndef _P80211METAMIB_H | ||
58 | #define _P80211METAMIB_H | ||
59 | |||
60 | /*================================================================*/ | ||
61 | /* System Includes */ | ||
62 | |||
63 | /*================================================================*/ | ||
64 | /* Project Includes */ | ||
65 | |||
66 | #ifndef _WLAN_COMPAT_H | ||
67 | #include "wlan_compat.h" | ||
68 | #endif | ||
69 | |||
70 | /*================================================================*/ | ||
71 | /* Constants */ | ||
72 | |||
73 | /*----------------------------------------------------------------*/ | ||
74 | /* */ | ||
75 | |||
76 | /*================================================================*/ | ||
77 | /* Macros */ | ||
78 | |||
79 | /*----------------------------------------------------------------*/ | ||
80 | /* */ | ||
81 | |||
82 | /*================================================================*/ | ||
83 | /* Types */ | ||
84 | |||
85 | /*----------------------------------------------------------------*/ | ||
86 | /* */ | ||
87 | |||
88 | /*================================================================*/ | ||
89 | /* Extern Declarations */ | ||
90 | |||
91 | /*----------------------------------------------------------------*/ | ||
92 | /* The following is the external declaration for the mib */ | ||
93 | /* category metadata list */ | ||
94 | |||
95 | extern catlistitem_t mib_catlist[]; | ||
96 | extern UINT32 mib_catlist_size; | ||
97 | |||
98 | |||
99 | /*================================================================*/ | ||
100 | /* Function Declarations */ | ||
101 | |||
102 | /*----------------------------------------------------------------*/ | ||
103 | /* */ | ||
104 | |||
105 | #endif /* _P80211METAMIB_H */ | ||
diff --git a/drivers/staging/wlan-ng/p80211metamsg.h b/drivers/staging/wlan-ng/p80211metamsg.h new file mode 100644 index 000000000000..4d6dfcc79b86 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211metamsg.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* p80211metamsg.h | ||
2 | * | ||
3 | * Macros, const, types, and funcs for p80211 msg metadata | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares some of the constants and types used in various | ||
48 | * parts of the linux-wlan system. | ||
49 | * | ||
50 | * Notes: | ||
51 | * - Constant values are always in HOST byte order. | ||
52 | * | ||
53 | * All functions and statics declared here are implemented in p80211types.c | ||
54 | * -------------------------------------------------------------------- | ||
55 | */ | ||
56 | |||
57 | #ifndef _P80211METAMSG_H | ||
58 | #define _P80211METAMSG_H | ||
59 | |||
60 | /*================================================================*/ | ||
61 | /* System Includes */ | ||
62 | |||
63 | /*================================================================*/ | ||
64 | /* Project Includes */ | ||
65 | |||
66 | #ifndef _WLAN_COMPAT_H | ||
67 | #include "wlan_compat.h" | ||
68 | #endif | ||
69 | |||
70 | /*================================================================*/ | ||
71 | /* Constants */ | ||
72 | |||
73 | /*----------------------------------------------------------------*/ | ||
74 | /* */ | ||
75 | |||
76 | /*================================================================*/ | ||
77 | /* Macros */ | ||
78 | |||
79 | /*----------------------------------------------------------------*/ | ||
80 | /* */ | ||
81 | |||
82 | /*================================================================*/ | ||
83 | /* Types */ | ||
84 | |||
85 | /*----------------------------------------------------------------*/ | ||
86 | /* */ | ||
87 | |||
88 | /*================================================================*/ | ||
89 | /* Extern Declarations */ | ||
90 | |||
91 | /*----------------------------------------------------------------*/ | ||
92 | /* The following is the external declaration for the message */ | ||
93 | /* category metadata list */ | ||
94 | |||
95 | extern catlistitem_t msg_catlist[]; | ||
96 | extern UINT32 msg_catlist_size; | ||
97 | |||
98 | |||
99 | /*================================================================*/ | ||
100 | /* Function Declarations */ | ||
101 | |||
102 | /*----------------------------------------------------------------*/ | ||
103 | /* */ | ||
104 | |||
105 | #endif /* _P80211METAMSG_H */ | ||
diff --git a/drivers/staging/wlan-ng/p80211metastruct.h b/drivers/staging/wlan-ng/p80211metastruct.h new file mode 100644 index 000000000000..715f4b2adc65 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211metastruct.h | |||
@@ -0,0 +1,644 @@ | |||
1 | /* This file is GENERATED AUTOMATICALLY. DO NOT EDIT OR MODIFY. | ||
2 | * -------------------------------------------------------------------- | ||
3 | * | ||
4 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
5 | * -------------------------------------------------------------------- | ||
6 | * | ||
7 | * linux-wlan | ||
8 | * | ||
9 | * The contents of this file are subject to the Mozilla Public | ||
10 | * License Version 1.1 (the "License"); you may not use this file | ||
11 | * except in compliance with the License. You may obtain a copy of | ||
12 | * the License at http://www.mozilla.org/MPL/ | ||
13 | * | ||
14 | * Software distributed under the License is distributed on an "AS | ||
15 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
16 | * implied. See the License for the specific language governing | ||
17 | * rights and limitations under the License. | ||
18 | * | ||
19 | * Alternatively, the contents of this file may be used under the | ||
20 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
21 | * case the provisions of the GPL are applicable instead of the | ||
22 | * above. If you wish to allow the use of your version of this file | ||
23 | * only under the terms of the GPL and not to allow others to use | ||
24 | * your version of this file under the MPL, indicate your decision | ||
25 | * by deleting the provisions above and replace them with the notice | ||
26 | * and other provisions required by the GPL. If you do not delete | ||
27 | * the provisions above, a recipient may use your version of this | ||
28 | * file under either the MPL or the GPL. | ||
29 | * | ||
30 | * -------------------------------------------------------------------- | ||
31 | * | ||
32 | * Inquiries regarding the linux-wlan Open Source project can be | ||
33 | * made directly to: | ||
34 | * | ||
35 | * AbsoluteValue Systems Inc. | ||
36 | * info@linux-wlan.com | ||
37 | * http://www.linux-wlan.com | ||
38 | * | ||
39 | * -------------------------------------------------------------------- | ||
40 | * | ||
41 | * Portions of the development of this software were funded by | ||
42 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
43 | * | ||
44 | * -------------------------------------------------------------------- | ||
45 | */ | ||
46 | |||
47 | #ifndef _P80211MKMETASTRUCT_H | ||
48 | #define _P80211MKMETASTRUCT_H | ||
49 | |||
50 | |||
51 | typedef struct p80211msg_dot11req_mibget | ||
52 | { | ||
53 | UINT32 msgcode ; | ||
54 | UINT32 msglen ; | ||
55 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
56 | p80211item_unk392_t mibattribute ; | ||
57 | p80211item_uint32_t resultcode ; | ||
58 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_mibget_t; | ||
59 | |||
60 | typedef struct p80211msg_dot11req_mibset | ||
61 | { | ||
62 | UINT32 msgcode ; | ||
63 | UINT32 msglen ; | ||
64 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
65 | p80211item_unk392_t mibattribute ; | ||
66 | p80211item_uint32_t resultcode ; | ||
67 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_mibset_t; | ||
68 | |||
69 | typedef struct p80211msg_dot11req_powermgmt | ||
70 | { | ||
71 | UINT32 msgcode ; | ||
72 | UINT32 msglen ; | ||
73 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
74 | p80211item_uint32_t powermgmtmode ; | ||
75 | p80211item_uint32_t wakeup ; | ||
76 | p80211item_uint32_t receivedtims ; | ||
77 | p80211item_uint32_t resultcode ; | ||
78 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_powermgmt_t; | ||
79 | |||
80 | typedef struct p80211msg_dot11req_scan | ||
81 | { | ||
82 | UINT32 msgcode ; | ||
83 | UINT32 msglen ; | ||
84 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
85 | p80211item_uint32_t bsstype ; | ||
86 | p80211item_pstr6_t bssid ; | ||
87 | UINT8 pad_0C[1] ; | ||
88 | p80211item_pstr32_t ssid ; | ||
89 | UINT8 pad_1D[3] ; | ||
90 | p80211item_uint32_t scantype ; | ||
91 | p80211item_uint32_t probedelay ; | ||
92 | p80211item_pstr14_t channellist ; | ||
93 | UINT8 pad_2C[1] ; | ||
94 | p80211item_uint32_t minchanneltime ; | ||
95 | p80211item_uint32_t maxchanneltime ; | ||
96 | p80211item_uint32_t resultcode ; | ||
97 | p80211item_uint32_t numbss ; | ||
98 | p80211item_uint32_t append ; | ||
99 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_scan_t; | ||
100 | |||
101 | typedef struct p80211msg_dot11req_scan_results | ||
102 | { | ||
103 | UINT32 msgcode ; | ||
104 | UINT32 msglen ; | ||
105 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
106 | p80211item_uint32_t bssindex ; | ||
107 | p80211item_uint32_t resultcode ; | ||
108 | p80211item_uint32_t signal ; | ||
109 | p80211item_uint32_t noise ; | ||
110 | p80211item_pstr6_t bssid ; | ||
111 | UINT8 pad_3C[1] ; | ||
112 | p80211item_pstr32_t ssid ; | ||
113 | UINT8 pad_4D[3] ; | ||
114 | p80211item_uint32_t bsstype ; | ||
115 | p80211item_uint32_t beaconperiod ; | ||
116 | p80211item_uint32_t dtimperiod ; | ||
117 | p80211item_uint32_t timestamp ; | ||
118 | p80211item_uint32_t localtime ; | ||
119 | p80211item_uint32_t fhdwelltime ; | ||
120 | p80211item_uint32_t fhhopset ; | ||
121 | p80211item_uint32_t fhhoppattern ; | ||
122 | p80211item_uint32_t fhhopindex ; | ||
123 | p80211item_uint32_t dschannel ; | ||
124 | p80211item_uint32_t cfpcount ; | ||
125 | p80211item_uint32_t cfpperiod ; | ||
126 | p80211item_uint32_t cfpmaxduration ; | ||
127 | p80211item_uint32_t cfpdurremaining ; | ||
128 | p80211item_uint32_t ibssatimwindow ; | ||
129 | p80211item_uint32_t cfpollable ; | ||
130 | p80211item_uint32_t cfpollreq ; | ||
131 | p80211item_uint32_t privacy ; | ||
132 | p80211item_uint32_t basicrate1 ; | ||
133 | p80211item_uint32_t basicrate2 ; | ||
134 | p80211item_uint32_t basicrate3 ; | ||
135 | p80211item_uint32_t basicrate4 ; | ||
136 | p80211item_uint32_t basicrate5 ; | ||
137 | p80211item_uint32_t basicrate6 ; | ||
138 | p80211item_uint32_t basicrate7 ; | ||
139 | p80211item_uint32_t basicrate8 ; | ||
140 | p80211item_uint32_t supprate1 ; | ||
141 | p80211item_uint32_t supprate2 ; | ||
142 | p80211item_uint32_t supprate3 ; | ||
143 | p80211item_uint32_t supprate4 ; | ||
144 | p80211item_uint32_t supprate5 ; | ||
145 | p80211item_uint32_t supprate6 ; | ||
146 | p80211item_uint32_t supprate7 ; | ||
147 | p80211item_uint32_t supprate8 ; | ||
148 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_scan_results_t; | ||
149 | |||
150 | typedef struct p80211msg_dot11req_join | ||
151 | { | ||
152 | UINT32 msgcode ; | ||
153 | UINT32 msglen ; | ||
154 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
155 | p80211item_pstr6_t bssid ; | ||
156 | UINT8 pad_5C[1] ; | ||
157 | p80211item_uint32_t joinfailuretimeout ; | ||
158 | p80211item_uint32_t basicrate1 ; | ||
159 | p80211item_uint32_t basicrate2 ; | ||
160 | p80211item_uint32_t basicrate3 ; | ||
161 | p80211item_uint32_t basicrate4 ; | ||
162 | p80211item_uint32_t basicrate5 ; | ||
163 | p80211item_uint32_t basicrate6 ; | ||
164 | p80211item_uint32_t basicrate7 ; | ||
165 | p80211item_uint32_t basicrate8 ; | ||
166 | p80211item_uint32_t operationalrate1 ; | ||
167 | p80211item_uint32_t operationalrate2 ; | ||
168 | p80211item_uint32_t operationalrate3 ; | ||
169 | p80211item_uint32_t operationalrate4 ; | ||
170 | p80211item_uint32_t operationalrate5 ; | ||
171 | p80211item_uint32_t operationalrate6 ; | ||
172 | p80211item_uint32_t operationalrate7 ; | ||
173 | p80211item_uint32_t operationalrate8 ; | ||
174 | p80211item_uint32_t resultcode ; | ||
175 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_join_t; | ||
176 | |||
177 | typedef struct p80211msg_dot11req_authenticate | ||
178 | { | ||
179 | UINT32 msgcode ; | ||
180 | UINT32 msglen ; | ||
181 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
182 | p80211item_pstr6_t peerstaaddress ; | ||
183 | UINT8 pad_6C[1] ; | ||
184 | p80211item_uint32_t authenticationtype ; | ||
185 | p80211item_uint32_t authenticationfailuretimeout ; | ||
186 | p80211item_uint32_t resultcode ; | ||
187 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_authenticate_t; | ||
188 | |||
189 | typedef struct p80211msg_dot11req_deauthenticate | ||
190 | { | ||
191 | UINT32 msgcode ; | ||
192 | UINT32 msglen ; | ||
193 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
194 | p80211item_pstr6_t peerstaaddress ; | ||
195 | UINT8 pad_7C[1] ; | ||
196 | p80211item_uint32_t reasoncode ; | ||
197 | p80211item_uint32_t resultcode ; | ||
198 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_deauthenticate_t; | ||
199 | |||
200 | typedef struct p80211msg_dot11req_associate | ||
201 | { | ||
202 | UINT32 msgcode ; | ||
203 | UINT32 msglen ; | ||
204 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
205 | p80211item_pstr6_t peerstaaddress ; | ||
206 | UINT8 pad_8C[1] ; | ||
207 | p80211item_uint32_t associatefailuretimeout ; | ||
208 | p80211item_uint32_t cfpollable ; | ||
209 | p80211item_uint32_t cfpollreq ; | ||
210 | p80211item_uint32_t privacy ; | ||
211 | p80211item_uint32_t listeninterval ; | ||
212 | p80211item_uint32_t resultcode ; | ||
213 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_associate_t; | ||
214 | |||
215 | typedef struct p80211msg_dot11req_reassociate | ||
216 | { | ||
217 | UINT32 msgcode ; | ||
218 | UINT32 msglen ; | ||
219 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
220 | p80211item_pstr6_t newapaddress ; | ||
221 | UINT8 pad_9C[1] ; | ||
222 | p80211item_uint32_t reassociatefailuretimeout ; | ||
223 | p80211item_uint32_t cfpollable ; | ||
224 | p80211item_uint32_t cfpollreq ; | ||
225 | p80211item_uint32_t privacy ; | ||
226 | p80211item_uint32_t listeninterval ; | ||
227 | p80211item_uint32_t resultcode ; | ||
228 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_reassociate_t; | ||
229 | |||
230 | typedef struct p80211msg_dot11req_disassociate | ||
231 | { | ||
232 | UINT32 msgcode ; | ||
233 | UINT32 msglen ; | ||
234 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
235 | p80211item_pstr6_t peerstaaddress ; | ||
236 | UINT8 pad_10C[1] ; | ||
237 | p80211item_uint32_t reasoncode ; | ||
238 | p80211item_uint32_t resultcode ; | ||
239 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_disassociate_t; | ||
240 | |||
241 | typedef struct p80211msg_dot11req_reset | ||
242 | { | ||
243 | UINT32 msgcode ; | ||
244 | UINT32 msglen ; | ||
245 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
246 | p80211item_uint32_t setdefaultmib ; | ||
247 | p80211item_pstr6_t macaddress ; | ||
248 | UINT8 pad_11C[1] ; | ||
249 | p80211item_uint32_t resultcode ; | ||
250 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_reset_t; | ||
251 | |||
252 | typedef struct p80211msg_dot11req_start | ||
253 | { | ||
254 | UINT32 msgcode ; | ||
255 | UINT32 msglen ; | ||
256 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
257 | p80211item_pstr32_t ssid ; | ||
258 | UINT8 pad_12D[3] ; | ||
259 | p80211item_uint32_t bsstype ; | ||
260 | p80211item_uint32_t beaconperiod ; | ||
261 | p80211item_uint32_t dtimperiod ; | ||
262 | p80211item_uint32_t cfpperiod ; | ||
263 | p80211item_uint32_t cfpmaxduration ; | ||
264 | p80211item_uint32_t fhdwelltime ; | ||
265 | p80211item_uint32_t fhhopset ; | ||
266 | p80211item_uint32_t fhhoppattern ; | ||
267 | p80211item_uint32_t dschannel ; | ||
268 | p80211item_uint32_t ibssatimwindow ; | ||
269 | p80211item_uint32_t probedelay ; | ||
270 | p80211item_uint32_t cfpollable ; | ||
271 | p80211item_uint32_t cfpollreq ; | ||
272 | p80211item_uint32_t basicrate1 ; | ||
273 | p80211item_uint32_t basicrate2 ; | ||
274 | p80211item_uint32_t basicrate3 ; | ||
275 | p80211item_uint32_t basicrate4 ; | ||
276 | p80211item_uint32_t basicrate5 ; | ||
277 | p80211item_uint32_t basicrate6 ; | ||
278 | p80211item_uint32_t basicrate7 ; | ||
279 | p80211item_uint32_t basicrate8 ; | ||
280 | p80211item_uint32_t operationalrate1 ; | ||
281 | p80211item_uint32_t operationalrate2 ; | ||
282 | p80211item_uint32_t operationalrate3 ; | ||
283 | p80211item_uint32_t operationalrate4 ; | ||
284 | p80211item_uint32_t operationalrate5 ; | ||
285 | p80211item_uint32_t operationalrate6 ; | ||
286 | p80211item_uint32_t operationalrate7 ; | ||
287 | p80211item_uint32_t operationalrate8 ; | ||
288 | p80211item_uint32_t resultcode ; | ||
289 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11req_start_t; | ||
290 | |||
291 | typedef struct p80211msg_dot11ind_authenticate | ||
292 | { | ||
293 | UINT32 msgcode ; | ||
294 | UINT32 msglen ; | ||
295 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
296 | p80211item_pstr6_t peerstaaddress ; | ||
297 | UINT8 pad_13C[1] ; | ||
298 | p80211item_uint32_t authenticationtype ; | ||
299 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11ind_authenticate_t; | ||
300 | |||
301 | typedef struct p80211msg_dot11ind_deauthenticate | ||
302 | { | ||
303 | UINT32 msgcode ; | ||
304 | UINT32 msglen ; | ||
305 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
306 | p80211item_pstr6_t peerstaaddress ; | ||
307 | UINT8 pad_14C[1] ; | ||
308 | p80211item_uint32_t reasoncode ; | ||
309 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11ind_deauthenticate_t; | ||
310 | |||
311 | typedef struct p80211msg_dot11ind_associate | ||
312 | { | ||
313 | UINT32 msgcode ; | ||
314 | UINT32 msglen ; | ||
315 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
316 | p80211item_pstr6_t peerstaaddress ; | ||
317 | UINT8 pad_15C[1] ; | ||
318 | p80211item_uint32_t aid ; | ||
319 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11ind_associate_t; | ||
320 | |||
321 | typedef struct p80211msg_dot11ind_reassociate | ||
322 | { | ||
323 | UINT32 msgcode ; | ||
324 | UINT32 msglen ; | ||
325 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
326 | p80211item_pstr6_t peerstaaddress ; | ||
327 | UINT8 pad_16C[1] ; | ||
328 | p80211item_uint32_t aid ; | ||
329 | p80211item_pstr6_t oldapaddress ; | ||
330 | UINT8 pad_17C[1] ; | ||
331 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11ind_reassociate_t; | ||
332 | |||
333 | typedef struct p80211msg_dot11ind_disassociate | ||
334 | { | ||
335 | UINT32 msgcode ; | ||
336 | UINT32 msglen ; | ||
337 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
338 | p80211item_pstr6_t peerstaaddress ; | ||
339 | UINT8 pad_18C[1] ; | ||
340 | p80211item_uint32_t reasoncode ; | ||
341 | } __WLAN_ATTRIB_PACK__ p80211msg_dot11ind_disassociate_t; | ||
342 | |||
343 | typedef struct p80211msg_lnxreq_ifstate | ||
344 | { | ||
345 | UINT32 msgcode ; | ||
346 | UINT32 msglen ; | ||
347 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
348 | p80211item_uint32_t ifstate ; | ||
349 | p80211item_uint32_t resultcode ; | ||
350 | } __WLAN_ATTRIB_PACK__ p80211msg_lnxreq_ifstate_t; | ||
351 | |||
352 | typedef struct p80211msg_lnxreq_wlansniff | ||
353 | { | ||
354 | UINT32 msgcode ; | ||
355 | UINT32 msglen ; | ||
356 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
357 | p80211item_uint32_t enable ; | ||
358 | p80211item_uint32_t channel ; | ||
359 | p80211item_uint32_t prismheader ; | ||
360 | p80211item_uint32_t wlanheader ; | ||
361 | p80211item_uint32_t keepwepflags ; | ||
362 | p80211item_uint32_t stripfcs ; | ||
363 | p80211item_uint32_t packet_trunc ; | ||
364 | p80211item_uint32_t resultcode ; | ||
365 | } __WLAN_ATTRIB_PACK__ p80211msg_lnxreq_wlansniff_t; | ||
366 | |||
367 | typedef struct p80211msg_lnxreq_hostwep | ||
368 | { | ||
369 | UINT32 msgcode ; | ||
370 | UINT32 msglen ; | ||
371 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
372 | p80211item_uint32_t resultcode ; | ||
373 | p80211item_uint32_t decrypt ; | ||
374 | p80211item_uint32_t encrypt ; | ||
375 | } __WLAN_ATTRIB_PACK__ p80211msg_lnxreq_hostwep_t; | ||
376 | |||
377 | typedef struct p80211msg_lnxreq_commsquality | ||
378 | { | ||
379 | UINT32 msgcode ; | ||
380 | UINT32 msglen ; | ||
381 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
382 | p80211item_uint32_t resultcode ; | ||
383 | p80211item_uint32_t dbm ; | ||
384 | p80211item_uint32_t link ; | ||
385 | p80211item_uint32_t level ; | ||
386 | p80211item_uint32_t noise ; | ||
387 | } __WLAN_ATTRIB_PACK__ p80211msg_lnxreq_commsquality_t; | ||
388 | |||
389 | typedef struct p80211msg_lnxreq_autojoin | ||
390 | { | ||
391 | UINT32 msgcode ; | ||
392 | UINT32 msglen ; | ||
393 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
394 | p80211item_pstr32_t ssid ; | ||
395 | UINT8 pad_19D[3] ; | ||
396 | p80211item_uint32_t authtype ; | ||
397 | p80211item_uint32_t resultcode ; | ||
398 | } __WLAN_ATTRIB_PACK__ p80211msg_lnxreq_autojoin_t; | ||
399 | |||
400 | typedef struct p80211msg_lnxind_wlansniffrm | ||
401 | { | ||
402 | UINT32 msgcode ; | ||
403 | UINT32 msglen ; | ||
404 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
405 | p80211item_uint32_t hosttime ; | ||
406 | p80211item_uint32_t mactime ; | ||
407 | p80211item_uint32_t channel ; | ||
408 | p80211item_uint32_t rssi ; | ||
409 | p80211item_uint32_t sq ; | ||
410 | p80211item_uint32_t signal ; | ||
411 | p80211item_uint32_t noise ; | ||
412 | p80211item_uint32_t rate ; | ||
413 | p80211item_uint32_t istx ; | ||
414 | p80211item_uint32_t frmlen ; | ||
415 | } __WLAN_ATTRIB_PACK__ p80211msg_lnxind_wlansniffrm_t; | ||
416 | |||
417 | typedef struct p80211msg_lnxind_roam | ||
418 | { | ||
419 | UINT32 msgcode ; | ||
420 | UINT32 msglen ; | ||
421 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
422 | p80211item_uint32_t reason ; | ||
423 | } __WLAN_ATTRIB_PACK__ p80211msg_lnxind_roam_t; | ||
424 | |||
425 | typedef struct p80211msg_p2req_join | ||
426 | { | ||
427 | UINT32 msgcode ; | ||
428 | UINT32 msglen ; | ||
429 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
430 | p80211item_pstr6_t bssid ; | ||
431 | UINT8 pad_20C[1] ; | ||
432 | p80211item_uint32_t basicrate1 ; | ||
433 | p80211item_uint32_t basicrate2 ; | ||
434 | p80211item_uint32_t basicrate3 ; | ||
435 | p80211item_uint32_t basicrate4 ; | ||
436 | p80211item_uint32_t basicrate5 ; | ||
437 | p80211item_uint32_t basicrate6 ; | ||
438 | p80211item_uint32_t basicrate7 ; | ||
439 | p80211item_uint32_t basicrate8 ; | ||
440 | p80211item_uint32_t operationalrate1 ; | ||
441 | p80211item_uint32_t operationalrate2 ; | ||
442 | p80211item_uint32_t operationalrate3 ; | ||
443 | p80211item_uint32_t operationalrate4 ; | ||
444 | p80211item_uint32_t operationalrate5 ; | ||
445 | p80211item_uint32_t operationalrate6 ; | ||
446 | p80211item_uint32_t operationalrate7 ; | ||
447 | p80211item_uint32_t operationalrate8 ; | ||
448 | p80211item_pstr32_t ssid ; | ||
449 | UINT8 pad_21D[3] ; | ||
450 | p80211item_uint32_t channel ; | ||
451 | p80211item_uint32_t authtype ; | ||
452 | p80211item_uint32_t resultcode ; | ||
453 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_join_t; | ||
454 | |||
455 | typedef struct p80211msg_p2req_readpda | ||
456 | { | ||
457 | UINT32 msgcode ; | ||
458 | UINT32 msglen ; | ||
459 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
460 | p80211item_unk1024_t pda ; | ||
461 | p80211item_uint32_t resultcode ; | ||
462 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_readpda_t; | ||
463 | |||
464 | typedef struct p80211msg_p2req_readcis | ||
465 | { | ||
466 | UINT32 msgcode ; | ||
467 | UINT32 msglen ; | ||
468 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
469 | p80211item_unk1024_t cis ; | ||
470 | p80211item_uint32_t resultcode ; | ||
471 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_readcis_t; | ||
472 | |||
473 | typedef struct p80211msg_p2req_auxport_state | ||
474 | { | ||
475 | UINT32 msgcode ; | ||
476 | UINT32 msglen ; | ||
477 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
478 | p80211item_uint32_t enable ; | ||
479 | p80211item_uint32_t resultcode ; | ||
480 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_auxport_state_t; | ||
481 | |||
482 | typedef struct p80211msg_p2req_auxport_read | ||
483 | { | ||
484 | UINT32 msgcode ; | ||
485 | UINT32 msglen ; | ||
486 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
487 | p80211item_uint32_t addr ; | ||
488 | p80211item_uint32_t len ; | ||
489 | p80211item_unk1024_t data ; | ||
490 | p80211item_uint32_t resultcode ; | ||
491 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_auxport_read_t; | ||
492 | |||
493 | typedef struct p80211msg_p2req_auxport_write | ||
494 | { | ||
495 | UINT32 msgcode ; | ||
496 | UINT32 msglen ; | ||
497 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
498 | p80211item_uint32_t addr ; | ||
499 | p80211item_uint32_t len ; | ||
500 | p80211item_unk1024_t data ; | ||
501 | p80211item_uint32_t resultcode ; | ||
502 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_auxport_write_t; | ||
503 | |||
504 | typedef struct p80211msg_p2req_low_level | ||
505 | { | ||
506 | UINT32 msgcode ; | ||
507 | UINT32 msglen ; | ||
508 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
509 | p80211item_uint32_t command ; | ||
510 | p80211item_uint32_t param0 ; | ||
511 | p80211item_uint32_t param1 ; | ||
512 | p80211item_uint32_t param2 ; | ||
513 | p80211item_uint32_t resp0 ; | ||
514 | p80211item_uint32_t resp1 ; | ||
515 | p80211item_uint32_t resp2 ; | ||
516 | p80211item_uint32_t resultcode ; | ||
517 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_low_level_t; | ||
518 | |||
519 | typedef struct p80211msg_p2req_test_command | ||
520 | { | ||
521 | UINT32 msgcode ; | ||
522 | UINT32 msglen ; | ||
523 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
524 | p80211item_uint32_t testcode ; | ||
525 | p80211item_uint32_t testparam ; | ||
526 | p80211item_uint32_t resultcode ; | ||
527 | p80211item_uint32_t status ; | ||
528 | p80211item_uint32_t resp0 ; | ||
529 | p80211item_uint32_t resp1 ; | ||
530 | p80211item_uint32_t resp2 ; | ||
531 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_test_command_t; | ||
532 | |||
533 | typedef struct p80211msg_p2req_mmi_read | ||
534 | { | ||
535 | UINT32 msgcode ; | ||
536 | UINT32 msglen ; | ||
537 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
538 | p80211item_uint32_t addr ; | ||
539 | p80211item_uint32_t value ; | ||
540 | p80211item_uint32_t resultcode ; | ||
541 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_mmi_read_t; | ||
542 | |||
543 | typedef struct p80211msg_p2req_mmi_write | ||
544 | { | ||
545 | UINT32 msgcode ; | ||
546 | UINT32 msglen ; | ||
547 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
548 | p80211item_uint32_t addr ; | ||
549 | p80211item_uint32_t data ; | ||
550 | p80211item_uint32_t resultcode ; | ||
551 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_mmi_write_t; | ||
552 | |||
553 | typedef struct p80211msg_p2req_ramdl_state | ||
554 | { | ||
555 | UINT32 msgcode ; | ||
556 | UINT32 msglen ; | ||
557 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
558 | p80211item_uint32_t enable ; | ||
559 | p80211item_uint32_t exeaddr ; | ||
560 | p80211item_uint32_t resultcode ; | ||
561 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_ramdl_state_t; | ||
562 | |||
563 | typedef struct p80211msg_p2req_ramdl_write | ||
564 | { | ||
565 | UINT32 msgcode ; | ||
566 | UINT32 msglen ; | ||
567 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
568 | p80211item_uint32_t addr ; | ||
569 | p80211item_uint32_t len ; | ||
570 | p80211item_unk4096_t data ; | ||
571 | p80211item_uint32_t resultcode ; | ||
572 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_ramdl_write_t; | ||
573 | |||
574 | typedef struct p80211msg_p2req_flashdl_state | ||
575 | { | ||
576 | UINT32 msgcode ; | ||
577 | UINT32 msglen ; | ||
578 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
579 | p80211item_uint32_t enable ; | ||
580 | p80211item_uint32_t resultcode ; | ||
581 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_flashdl_state_t; | ||
582 | |||
583 | typedef struct p80211msg_p2req_flashdl_write | ||
584 | { | ||
585 | UINT32 msgcode ; | ||
586 | UINT32 msglen ; | ||
587 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
588 | p80211item_uint32_t addr ; | ||
589 | p80211item_uint32_t len ; | ||
590 | p80211item_unk4096_t data ; | ||
591 | p80211item_uint32_t resultcode ; | ||
592 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_flashdl_write_t; | ||
593 | |||
594 | typedef struct p80211msg_p2req_mm_state | ||
595 | { | ||
596 | UINT32 msgcode ; | ||
597 | UINT32 msglen ; | ||
598 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
599 | p80211item_uint32_t enable ; | ||
600 | p80211item_uint32_t resultcode ; | ||
601 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_mm_state_t; | ||
602 | |||
603 | typedef struct p80211msg_p2req_dump_state | ||
604 | { | ||
605 | UINT32 msgcode ; | ||
606 | UINT32 msglen ; | ||
607 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
608 | p80211item_uint32_t level ; | ||
609 | p80211item_uint32_t resultcode ; | ||
610 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_dump_state_t; | ||
611 | |||
612 | typedef struct p80211msg_p2req_channel_info | ||
613 | { | ||
614 | UINT32 msgcode ; | ||
615 | UINT32 msglen ; | ||
616 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
617 | p80211item_uint32_t channellist ; | ||
618 | p80211item_uint32_t channeldwelltime ; | ||
619 | p80211item_uint32_t resultcode ; | ||
620 | p80211item_uint32_t numchinfo ; | ||
621 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_channel_info_t; | ||
622 | |||
623 | typedef struct p80211msg_p2req_channel_info_results | ||
624 | { | ||
625 | UINT32 msgcode ; | ||
626 | UINT32 msglen ; | ||
627 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
628 | p80211item_uint32_t channel ; | ||
629 | p80211item_uint32_t resultcode ; | ||
630 | p80211item_uint32_t avgnoiselevel ; | ||
631 | p80211item_uint32_t peaknoiselevel ; | ||
632 | p80211item_uint32_t bssactive ; | ||
633 | p80211item_uint32_t pcfactive ; | ||
634 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_channel_info_results_t; | ||
635 | |||
636 | typedef struct p80211msg_p2req_enable | ||
637 | { | ||
638 | UINT32 msgcode ; | ||
639 | UINT32 msglen ; | ||
640 | UINT8 devname[WLAN_DEVNAMELEN_MAX] ; | ||
641 | p80211item_uint32_t resultcode ; | ||
642 | } __WLAN_ATTRIB_PACK__ p80211msg_p2req_enable_t; | ||
643 | |||
644 | #endif | ||
diff --git a/drivers/staging/wlan-ng/p80211mgmt.h b/drivers/staging/wlan-ng/p80211mgmt.h new file mode 100644 index 000000000000..bd4c1629eabf --- /dev/null +++ b/drivers/staging/wlan-ng/p80211mgmt.h | |||
@@ -0,0 +1,575 @@ | |||
1 | /* p80211mgmt.h | ||
2 | * | ||
3 | * Macros, types, and functions to handle 802.11 mgmt frames | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares the constants and types used in the interface | ||
48 | * between a wlan driver and the user mode utilities. | ||
49 | * | ||
50 | * Notes: | ||
51 | * - Constant values are always in HOST byte order. To assign | ||
52 | * values to multi-byte fields they _must_ be converted to | ||
53 | * ieee byte order. To retrieve multi-byte values from incoming | ||
54 | * frames, they must be converted to host order. | ||
55 | * | ||
56 | * - The len member of the frame structure does NOT!!! include | ||
57 | * the MAC CRC. Therefore, the len field on rx'd frames should | ||
58 | * have 4 subtracted from it. | ||
59 | * | ||
60 | * All functions declared here are implemented in p80211.c | ||
61 | * | ||
62 | * The types, macros, and functions defined here are primarily | ||
63 | * used for encoding and decoding management frames. They are | ||
64 | * designed to follow these patterns of use: | ||
65 | * | ||
66 | * DECODE: | ||
67 | * 1) a frame of length len is received into buffer b | ||
68 | * 2) using the hdr structure and macros, we determine the type | ||
69 | * 3) an appropriate mgmt frame structure, mf, is allocated and zeroed | ||
70 | * 4) mf.hdr = b | ||
71 | * mf.buf = b | ||
72 | * mf.len = len | ||
73 | * 5) call mgmt_decode( mf ) | ||
74 | * 6) the frame field pointers in mf are now set. Note that any | ||
75 | * multi-byte frame field values accessed using the frame field | ||
76 | * pointers are in ieee byte order and will have to be converted | ||
77 | * to host order. | ||
78 | * | ||
79 | * ENCODE: | ||
80 | * 1) Library client allocates buffer space for maximum length | ||
81 | * frame of the desired type | ||
82 | * 2) Library client allocates a mgmt frame structure, called mf, | ||
83 | * of the desired type | ||
84 | * 3) Set the following: | ||
85 | * mf.type = <desired type> | ||
86 | * mf.buf = <allocated buffer address> | ||
87 | * 4) call mgmt_encode( mf ) | ||
88 | * 5) all of the fixed field pointers and fixed length information element | ||
89 | * pointers in mf are now set to their respective locations in the | ||
90 | * allocated space (fortunately, all variable length information elements | ||
91 | * fall at the end of their respective frames). | ||
92 | * 5a) The length field is set to include the last of the fixed and fixed | ||
93 | * length fields. It may have to be updated for optional or variable | ||
94 | * length information elements. | ||
95 | * 6) Optional and variable length information elements are special cases | ||
96 | * and must be handled individually by the client code. | ||
97 | * -------------------------------------------------------------------- | ||
98 | */ | ||
99 | |||
100 | #ifndef _P80211MGMT_H | ||
101 | #define _P80211MGMT_H | ||
102 | |||
103 | /*================================================================*/ | ||
104 | /* System Includes */ | ||
105 | |||
106 | /*================================================================*/ | ||
107 | /* Project Includes */ | ||
108 | |||
109 | #ifndef _WLAN_COMPAT_H | ||
110 | #include "wlan_compat.h" | ||
111 | #endif | ||
112 | |||
113 | #ifndef _P80211HDR_H | ||
114 | #include "p80211hdr.h" | ||
115 | #endif | ||
116 | |||
117 | |||
118 | /*================================================================*/ | ||
119 | /* Constants */ | ||
120 | |||
121 | /*-- Information Element IDs --------------------*/ | ||
122 | #define WLAN_EID_SSID 0 | ||
123 | #define WLAN_EID_SUPP_RATES 1 | ||
124 | #define WLAN_EID_FH_PARMS 2 | ||
125 | #define WLAN_EID_DS_PARMS 3 | ||
126 | #define WLAN_EID_CF_PARMS 4 | ||
127 | #define WLAN_EID_TIM 5 | ||
128 | #define WLAN_EID_IBSS_PARMS 6 | ||
129 | /*-- values 7-15 reserved --*/ | ||
130 | #define WLAN_EID_CHALLENGE 16 | ||
131 | /*-- values 17-31 reserved for challenge text extension --*/ | ||
132 | /*-- values 32-255 reserved --*/ | ||
133 | |||
134 | /*-- Reason Codes -------------------------------*/ | ||
135 | #define WLAN_MGMT_REASON_RSVD 0 | ||
136 | #define WLAN_MGMT_REASON_UNSPEC 1 | ||
137 | #define WLAN_MGMT_REASON_PRIOR_AUTH_INVALID 2 | ||
138 | #define WLAN_MGMT_REASON_DEAUTH_LEAVING 3 | ||
139 | #define WLAN_MGMT_REASON_DISASSOC_INACTIVE 4 | ||
140 | #define WLAN_MGMT_REASON_DISASSOC_AP_BUSY 5 | ||
141 | #define WLAN_MGMT_REASON_CLASS2_NONAUTH 6 | ||
142 | #define WLAN_MGMT_REASON_CLASS3_NONASSOC 7 | ||
143 | #define WLAN_MGMT_REASON_DISASSOC_STA_HASLEFT 8 | ||
144 | #define WLAN_MGMT_REASON_CANT_ASSOC_NONAUTH 9 | ||
145 | |||
146 | /*-- Status Codes -------------------------------*/ | ||
147 | #define WLAN_MGMT_STATUS_SUCCESS 0 | ||
148 | #define WLAN_MGMT_STATUS_UNSPEC_FAILURE 1 | ||
149 | #define WLAN_MGMT_STATUS_CAPS_UNSUPPORTED 10 | ||
150 | #define WLAN_MGMT_STATUS_REASSOC_NO_ASSOC 11 | ||
151 | #define WLAN_MGMT_STATUS_ASSOC_DENIED_UNSPEC 12 | ||
152 | #define WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG 13 | ||
153 | #define WLAN_MGMT_STATUS_RX_AUTH_NOSEQ 14 | ||
154 | #define WLAN_MGMT_STATUS_CHALLENGE_FAIL 15 | ||
155 | #define WLAN_MGMT_STATUS_AUTH_TIMEOUT 16 | ||
156 | #define WLAN_MGMT_STATUS_ASSOC_DENIED_BUSY 17 | ||
157 | #define WLAN_MGMT_STATUS_ASSOC_DENIED_RATES 18 | ||
158 | /* p80211b additions */ | ||
159 | #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOSHORT 19 | ||
160 | #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOPBCC 20 | ||
161 | #define WLAN_MGMT_STATUS_ASSOC_DENIED_NOAGILITY 21 | ||
162 | |||
163 | |||
164 | |||
165 | /*-- Auth Algorithm Field ---------------------------*/ | ||
166 | #define WLAN_AUTH_ALG_OPENSYSTEM 0 | ||
167 | #define WLAN_AUTH_ALG_SHAREDKEY 1 | ||
168 | |||
169 | /*-- Management Frame Field Offsets -------------*/ | ||
170 | /* Note: Not all fields are listed because of variable lengths, */ | ||
171 | /* see the code in p80211.c to see how we search for fields */ | ||
172 | /* Note: These offsets are from the start of the frame data */ | ||
173 | |||
174 | #define WLAN_BEACON_OFF_TS 0 | ||
175 | #define WLAN_BEACON_OFF_BCN_INT 8 | ||
176 | #define WLAN_BEACON_OFF_CAPINFO 10 | ||
177 | #define WLAN_BEACON_OFF_SSID 12 | ||
178 | |||
179 | #define WLAN_DISASSOC_OFF_REASON 0 | ||
180 | |||
181 | #define WLAN_ASSOCREQ_OFF_CAP_INFO 0 | ||
182 | #define WLAN_ASSOCREQ_OFF_LISTEN_INT 2 | ||
183 | #define WLAN_ASSOCREQ_OFF_SSID 4 | ||
184 | |||
185 | #define WLAN_ASSOCRESP_OFF_CAP_INFO 0 | ||
186 | #define WLAN_ASSOCRESP_OFF_STATUS 2 | ||
187 | #define WLAN_ASSOCRESP_OFF_AID 4 | ||
188 | #define WLAN_ASSOCRESP_OFF_SUPP_RATES 6 | ||
189 | |||
190 | #define WLAN_REASSOCREQ_OFF_CAP_INFO 0 | ||
191 | #define WLAN_REASSOCREQ_OFF_LISTEN_INT 2 | ||
192 | #define WLAN_REASSOCREQ_OFF_CURR_AP 4 | ||
193 | #define WLAN_REASSOCREQ_OFF_SSID 10 | ||
194 | |||
195 | #define WLAN_REASSOCRESP_OFF_CAP_INFO 0 | ||
196 | #define WLAN_REASSOCRESP_OFF_STATUS 2 | ||
197 | #define WLAN_REASSOCRESP_OFF_AID 4 | ||
198 | #define WLAN_REASSOCRESP_OFF_SUPP_RATES 6 | ||
199 | |||
200 | #define WLAN_PROBEREQ_OFF_SSID 0 | ||
201 | |||
202 | #define WLAN_PROBERESP_OFF_TS 0 | ||
203 | #define WLAN_PROBERESP_OFF_BCN_INT 8 | ||
204 | #define WLAN_PROBERESP_OFF_CAP_INFO 10 | ||
205 | #define WLAN_PROBERESP_OFF_SSID 12 | ||
206 | |||
207 | #define WLAN_AUTHEN_OFF_AUTH_ALG 0 | ||
208 | #define WLAN_AUTHEN_OFF_AUTH_SEQ 2 | ||
209 | #define WLAN_AUTHEN_OFF_STATUS 4 | ||
210 | #define WLAN_AUTHEN_OFF_CHALLENGE 6 | ||
211 | |||
212 | #define WLAN_DEAUTHEN_OFF_REASON 0 | ||
213 | |||
214 | |||
215 | /*================================================================*/ | ||
216 | /* Macros */ | ||
217 | |||
218 | /*-- Capability Field ---------------------------*/ | ||
219 | #define WLAN_GET_MGMT_CAP_INFO_ESS(n) ((n) & BIT0) | ||
220 | #define WLAN_GET_MGMT_CAP_INFO_IBSS(n) (((n) & BIT1) >> 1) | ||
221 | #define WLAN_GET_MGMT_CAP_INFO_CFPOLLABLE(n) (((n) & BIT2) >> 2) | ||
222 | #define WLAN_GET_MGMT_CAP_INFO_CFPOLLREQ(n) (((n) & BIT3) >> 3) | ||
223 | #define WLAN_GET_MGMT_CAP_INFO_PRIVACY(n) (((n) & BIT4) >> 4) | ||
224 | /* p80211b additions */ | ||
225 | #define WLAN_GET_MGMT_CAP_INFO_SHORT(n) (((n) & BIT5) >> 5) | ||
226 | #define WLAN_GET_MGMT_CAP_INFO_PBCC(n) (((n) & BIT6) >> 6) | ||
227 | #define WLAN_GET_MGMT_CAP_INFO_AGILITY(n) (((n) & BIT7) >> 7) | ||
228 | |||
229 | #define WLAN_SET_MGMT_CAP_INFO_ESS(n) (n) | ||
230 | #define WLAN_SET_MGMT_CAP_INFO_IBSS(n) ((n) << 1) | ||
231 | #define WLAN_SET_MGMT_CAP_INFO_CFPOLLABLE(n) ((n) << 2) | ||
232 | #define WLAN_SET_MGMT_CAP_INFO_CFPOLLREQ(n) ((n) << 3) | ||
233 | #define WLAN_SET_MGMT_CAP_INFO_PRIVACY(n) ((n) << 4) | ||
234 | /* p80211b additions */ | ||
235 | #define WLAN_SET_MGMT_CAP_INFO_SHORT(n) ((n) << 5) | ||
236 | #define WLAN_SET_MGMT_CAP_INFO_PBCC(n) ((n) << 6) | ||
237 | #define WLAN_SET_MGMT_CAP_INFO_AGILITY(n) ((n) << 7) | ||
238 | |||
239 | |||
240 | /*================================================================*/ | ||
241 | /* Types */ | ||
242 | |||
243 | /*-- Information Element Types --------------------*/ | ||
244 | /* prototype structure, all IEs start with these members */ | ||
245 | |||
246 | typedef struct wlan_ie | ||
247 | { | ||
248 | UINT8 eid; | ||
249 | UINT8 len; | ||
250 | } __WLAN_ATTRIB_PACK__ wlan_ie_t; | ||
251 | |||
252 | /*-- Service Set Identity (SSID) -----------------*/ | ||
253 | typedef struct wlan_ie_ssid | ||
254 | { | ||
255 | UINT8 eid; | ||
256 | UINT8 len; | ||
257 | UINT8 ssid[1]; /* may be zero, ptrs may overlap */ | ||
258 | } __WLAN_ATTRIB_PACK__ wlan_ie_ssid_t; | ||
259 | |||
260 | /*-- Supported Rates -----------------------------*/ | ||
261 | typedef struct wlan_ie_supp_rates | ||
262 | { | ||
263 | UINT8 eid; | ||
264 | UINT8 len; | ||
265 | UINT8 rates[1]; /* had better be at LEAST one! */ | ||
266 | } __WLAN_ATTRIB_PACK__ wlan_ie_supp_rates_t; | ||
267 | |||
268 | /*-- FH Parameter Set ----------------------------*/ | ||
269 | typedef struct wlan_ie_fh_parms | ||
270 | { | ||
271 | UINT8 eid; | ||
272 | UINT8 len; | ||
273 | UINT16 dwell; | ||
274 | UINT8 hopset; | ||
275 | UINT8 hoppattern; | ||
276 | UINT8 hopindex; | ||
277 | } __WLAN_ATTRIB_PACK__ wlan_ie_fh_parms_t; | ||
278 | |||
279 | /*-- DS Parameter Set ----------------------------*/ | ||
280 | typedef struct wlan_ie_ds_parms | ||
281 | { | ||
282 | UINT8 eid; | ||
283 | UINT8 len; | ||
284 | UINT8 curr_ch; | ||
285 | } __WLAN_ATTRIB_PACK__ wlan_ie_ds_parms_t; | ||
286 | |||
287 | /*-- CF Parameter Set ----------------------------*/ | ||
288 | |||
289 | typedef struct wlan_ie_cf_parms | ||
290 | { | ||
291 | UINT8 eid; | ||
292 | UINT8 len; | ||
293 | UINT8 cfp_cnt; | ||
294 | UINT8 cfp_period; | ||
295 | UINT16 cfp_maxdur; | ||
296 | UINT16 cfp_durremaining; | ||
297 | } __WLAN_ATTRIB_PACK__ wlan_ie_cf_parms_t; | ||
298 | |||
299 | /*-- TIM ------------------------------------------*/ | ||
300 | typedef struct wlan_ie_tim | ||
301 | { | ||
302 | UINT8 eid; | ||
303 | UINT8 len; | ||
304 | UINT8 dtim_cnt; | ||
305 | UINT8 dtim_period; | ||
306 | UINT8 bitmap_ctl; | ||
307 | UINT8 virt_bm[1]; | ||
308 | } __WLAN_ATTRIB_PACK__ wlan_ie_tim_t; | ||
309 | |||
310 | /*-- IBSS Parameter Set ---------------------------*/ | ||
311 | typedef struct wlan_ie_ibss_parms | ||
312 | { | ||
313 | UINT8 eid; | ||
314 | UINT8 len; | ||
315 | UINT16 atim_win; | ||
316 | } __WLAN_ATTRIB_PACK__ wlan_ie_ibss_parms_t; | ||
317 | |||
318 | /*-- Challenge Text ------------------------------*/ | ||
319 | typedef struct wlan_ie_challenge | ||
320 | { | ||
321 | UINT8 eid; | ||
322 | UINT8 len; | ||
323 | UINT8 challenge[1]; | ||
324 | } __WLAN_ATTRIB_PACK__ wlan_ie_challenge_t; | ||
325 | |||
326 | /*-------------------------------------------------*/ | ||
327 | /* Frame Types */ | ||
328 | |||
329 | /* prototype structure, all mgmt frame types will start with these members */ | ||
330 | typedef struct wlan_fr_mgmt | ||
331 | { | ||
332 | UINT16 type; | ||
333 | UINT16 len; /* DOES NOT include CRC !!!!*/ | ||
334 | UINT8 *buf; | ||
335 | p80211_hdr_t *hdr; | ||
336 | /* used for target specific data, skb in Linux */ | ||
337 | void *priv; | ||
338 | /*-- fixed fields -----------*/ | ||
339 | /*-- info elements ----------*/ | ||
340 | } wlan_fr_mgmt_t; | ||
341 | |||
342 | /*-- Beacon ---------------------------------------*/ | ||
343 | typedef struct wlan_fr_beacon | ||
344 | { | ||
345 | UINT16 type; | ||
346 | UINT16 len; | ||
347 | UINT8 *buf; | ||
348 | p80211_hdr_t *hdr; | ||
349 | /* used for target specific data, skb in Linux */ | ||
350 | void *priv; | ||
351 | /*-- fixed fields -----------*/ | ||
352 | UINT64 *ts; | ||
353 | UINT16 *bcn_int; | ||
354 | UINT16 *cap_info; | ||
355 | /*-- info elements ----------*/ | ||
356 | wlan_ie_ssid_t *ssid; | ||
357 | wlan_ie_supp_rates_t *supp_rates; | ||
358 | wlan_ie_fh_parms_t *fh_parms; | ||
359 | wlan_ie_ds_parms_t *ds_parms; | ||
360 | wlan_ie_cf_parms_t *cf_parms; | ||
361 | wlan_ie_ibss_parms_t *ibss_parms; | ||
362 | wlan_ie_tim_t *tim; | ||
363 | |||
364 | } wlan_fr_beacon_t; | ||
365 | |||
366 | |||
367 | /*-- IBSS ATIM ------------------------------------*/ | ||
368 | typedef struct wlan_fr_ibssatim | ||
369 | { | ||
370 | UINT16 type; | ||
371 | UINT16 len; | ||
372 | UINT8* buf; | ||
373 | p80211_hdr_t *hdr; | ||
374 | /* used for target specific data, skb in Linux */ | ||
375 | void *priv; | ||
376 | |||
377 | /*-- fixed fields -----------*/ | ||
378 | /*-- info elements ----------*/ | ||
379 | |||
380 | /* this frame type has a null body */ | ||
381 | |||
382 | } wlan_fr_ibssatim_t; | ||
383 | |||
384 | /*-- Disassociation -------------------------------*/ | ||
385 | typedef struct wlan_fr_disassoc | ||
386 | { | ||
387 | UINT16 type; | ||
388 | UINT16 len; | ||
389 | UINT8 *buf; | ||
390 | p80211_hdr_t *hdr; | ||
391 | /* used for target specific data, skb in Linux */ | ||
392 | void *priv; | ||
393 | /*-- fixed fields -----------*/ | ||
394 | UINT16 *reason; | ||
395 | |||
396 | /*-- info elements ----------*/ | ||
397 | |||
398 | } wlan_fr_disassoc_t; | ||
399 | |||
400 | /*-- Association Request --------------------------*/ | ||
401 | typedef struct wlan_fr_assocreq | ||
402 | { | ||
403 | UINT16 type; | ||
404 | UINT16 len; | ||
405 | UINT8* buf; | ||
406 | p80211_hdr_t *hdr; | ||
407 | /* used for target specific data, skb in Linux */ | ||
408 | void *priv; | ||
409 | /*-- fixed fields -----------*/ | ||
410 | UINT16 *cap_info; | ||
411 | UINT16 *listen_int; | ||
412 | /*-- info elements ----------*/ | ||
413 | wlan_ie_ssid_t *ssid; | ||
414 | wlan_ie_supp_rates_t *supp_rates; | ||
415 | |||
416 | } wlan_fr_assocreq_t; | ||
417 | |||
418 | /*-- Association Response -------------------------*/ | ||
419 | typedef struct wlan_fr_assocresp | ||
420 | { | ||
421 | UINT16 type; | ||
422 | UINT16 len; | ||
423 | UINT8 *buf; | ||
424 | p80211_hdr_t *hdr; | ||
425 | /* used for target specific data, skb in Linux */ | ||
426 | void *priv; | ||
427 | /*-- fixed fields -----------*/ | ||
428 | UINT16 *cap_info; | ||
429 | UINT16 *status; | ||
430 | UINT16 *aid; | ||
431 | /*-- info elements ----------*/ | ||
432 | wlan_ie_supp_rates_t *supp_rates; | ||
433 | |||
434 | } wlan_fr_assocresp_t; | ||
435 | |||
436 | /*-- Reassociation Request ------------------------*/ | ||
437 | typedef struct wlan_fr_reassocreq | ||
438 | { | ||
439 | UINT16 type; | ||
440 | UINT16 len; | ||
441 | UINT8 *buf; | ||
442 | p80211_hdr_t *hdr; | ||
443 | /* used for target specific data, skb in Linux */ | ||
444 | void *priv; | ||
445 | /*-- fixed fields -----------*/ | ||
446 | UINT16 *cap_info; | ||
447 | UINT16 *listen_int; | ||
448 | UINT8 *curr_ap; | ||
449 | /*-- info elements ----------*/ | ||
450 | wlan_ie_ssid_t *ssid; | ||
451 | wlan_ie_supp_rates_t *supp_rates; | ||
452 | |||
453 | } wlan_fr_reassocreq_t; | ||
454 | |||
455 | /*-- Reassociation Response -----------------------*/ | ||
456 | typedef struct wlan_fr_reassocresp | ||
457 | { | ||
458 | UINT16 type; | ||
459 | UINT16 len; | ||
460 | UINT8 *buf; | ||
461 | p80211_hdr_t *hdr; | ||
462 | /* used for target specific data, skb in Linux */ | ||
463 | void *priv; | ||
464 | /*-- fixed fields -----------*/ | ||
465 | UINT16 *cap_info; | ||
466 | UINT16 *status; | ||
467 | UINT16 *aid; | ||
468 | /*-- info elements ----------*/ | ||
469 | wlan_ie_supp_rates_t *supp_rates; | ||
470 | |||
471 | } wlan_fr_reassocresp_t; | ||
472 | |||
473 | /*-- Probe Request --------------------------------*/ | ||
474 | typedef struct wlan_fr_probereq | ||
475 | { | ||
476 | UINT16 type; | ||
477 | UINT16 len; | ||
478 | UINT8 *buf; | ||
479 | p80211_hdr_t *hdr; | ||
480 | /* used for target specific data, skb in Linux */ | ||
481 | void *priv; | ||
482 | /*-- fixed fields -----------*/ | ||
483 | /*-- info elements ----------*/ | ||
484 | wlan_ie_ssid_t *ssid; | ||
485 | wlan_ie_supp_rates_t *supp_rates; | ||
486 | |||
487 | } wlan_fr_probereq_t; | ||
488 | |||
489 | /*-- Probe Response -------------------------------*/ | ||
490 | typedef struct wlan_fr_proberesp | ||
491 | { | ||
492 | UINT16 type; | ||
493 | UINT16 len; | ||
494 | UINT8 *buf; | ||
495 | p80211_hdr_t *hdr; | ||
496 | /* used for target specific data, skb in Linux */ | ||
497 | void *priv; | ||
498 | /*-- fixed fields -----------*/ | ||
499 | UINT64 *ts; | ||
500 | UINT16 *bcn_int; | ||
501 | UINT16 *cap_info; | ||
502 | /*-- info elements ----------*/ | ||
503 | wlan_ie_ssid_t *ssid; | ||
504 | wlan_ie_supp_rates_t *supp_rates; | ||
505 | wlan_ie_fh_parms_t *fh_parms; | ||
506 | wlan_ie_ds_parms_t *ds_parms; | ||
507 | wlan_ie_cf_parms_t *cf_parms; | ||
508 | wlan_ie_ibss_parms_t *ibss_parms; | ||
509 | } wlan_fr_proberesp_t; | ||
510 | |||
511 | /*-- Authentication -------------------------------*/ | ||
512 | typedef struct wlan_fr_authen | ||
513 | { | ||
514 | UINT16 type; | ||
515 | UINT16 len; | ||
516 | UINT8 *buf; | ||
517 | p80211_hdr_t *hdr; | ||
518 | /* used for target specific data, skb in Linux */ | ||
519 | void *priv; | ||
520 | /*-- fixed fields -----------*/ | ||
521 | UINT16 *auth_alg; | ||
522 | UINT16 *auth_seq; | ||
523 | UINT16 *status; | ||
524 | /*-- info elements ----------*/ | ||
525 | wlan_ie_challenge_t *challenge; | ||
526 | |||
527 | } wlan_fr_authen_t; | ||
528 | |||
529 | /*-- Deauthenication -----------------------------*/ | ||
530 | typedef struct wlan_fr_deauthen | ||
531 | { | ||
532 | UINT16 type; | ||
533 | UINT16 len; | ||
534 | UINT8 *buf; | ||
535 | p80211_hdr_t *hdr; | ||
536 | /* used for target specific data, skb in Linux */ | ||
537 | void *priv; | ||
538 | /*-- fixed fields -----------*/ | ||
539 | UINT16 *reason; | ||
540 | |||
541 | /*-- info elements ----------*/ | ||
542 | |||
543 | } wlan_fr_deauthen_t; | ||
544 | |||
545 | |||
546 | /*================================================================*/ | ||
547 | /* Extern Declarations */ | ||
548 | |||
549 | |||
550 | /*================================================================*/ | ||
551 | /* Function Declarations */ | ||
552 | |||
553 | void wlan_mgmt_encode_beacon( wlan_fr_beacon_t *f ); | ||
554 | void wlan_mgmt_decode_beacon( wlan_fr_beacon_t *f ); | ||
555 | void wlan_mgmt_encode_disassoc( wlan_fr_disassoc_t *f ); | ||
556 | void wlan_mgmt_decode_disassoc( wlan_fr_disassoc_t *f ); | ||
557 | void wlan_mgmt_encode_assocreq( wlan_fr_assocreq_t *f ); | ||
558 | void wlan_mgmt_decode_assocreq( wlan_fr_assocreq_t *f ); | ||
559 | void wlan_mgmt_encode_assocresp( wlan_fr_assocresp_t *f ); | ||
560 | void wlan_mgmt_decode_assocresp( wlan_fr_assocresp_t *f ); | ||
561 | void wlan_mgmt_encode_reassocreq( wlan_fr_reassocreq_t *f ); | ||
562 | void wlan_mgmt_decode_reassocreq( wlan_fr_reassocreq_t *f ); | ||
563 | void wlan_mgmt_encode_reassocresp( wlan_fr_reassocresp_t *f ); | ||
564 | void wlan_mgmt_decode_reassocresp( wlan_fr_reassocresp_t *f ); | ||
565 | void wlan_mgmt_encode_probereq( wlan_fr_probereq_t *f ); | ||
566 | void wlan_mgmt_decode_probereq( wlan_fr_probereq_t *f ); | ||
567 | void wlan_mgmt_encode_proberesp( wlan_fr_proberesp_t *f ); | ||
568 | void wlan_mgmt_decode_proberesp( wlan_fr_proberesp_t *f ); | ||
569 | void wlan_mgmt_encode_authen( wlan_fr_authen_t *f ); | ||
570 | void wlan_mgmt_decode_authen( wlan_fr_authen_t *f ); | ||
571 | void wlan_mgmt_encode_deauthen( wlan_fr_deauthen_t *f ); | ||
572 | void wlan_mgmt_decode_deauthen( wlan_fr_deauthen_t *f ); | ||
573 | |||
574 | |||
575 | #endif /* _P80211MGMT_H */ | ||
diff --git a/drivers/staging/wlan-ng/p80211mod.c b/drivers/staging/wlan-ng/p80211mod.c new file mode 100644 index 000000000000..e2c3f63be8be --- /dev/null +++ b/drivers/staging/wlan-ng/p80211mod.c | |||
@@ -0,0 +1,216 @@ | |||
1 | /* src/p80211/p80211mod.c | ||
2 | * | ||
3 | * Module entry and exit for p80211 | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file contains the p80211.o entry and exit points defined for linux | ||
48 | * kernel modules. | ||
49 | * | ||
50 | * Notes: | ||
51 | * - all module parameters for p80211.o should be defined here. | ||
52 | * | ||
53 | * -------------------------------------------------------------------- | ||
54 | */ | ||
55 | |||
56 | /*================================================================*/ | ||
57 | /* System Includes */ | ||
58 | |||
59 | |||
60 | #include <linux/version.h> | ||
61 | |||
62 | #include <linux/module.h> | ||
63 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,25)) | ||
64 | #include <linux/moduleparam.h> | ||
65 | #endif | ||
66 | |||
67 | #include <linux/kernel.h> | ||
68 | #include <linux/sched.h> | ||
69 | #include <linux/types.h> | ||
70 | #include <linux/wireless.h> | ||
71 | #include <linux/netdevice.h> | ||
72 | |||
73 | #include "version.h" | ||
74 | #include "wlan_compat.h" | ||
75 | |||
76 | /*================================================================*/ | ||
77 | /* Project Includes */ | ||
78 | |||
79 | #include "p80211types.h" | ||
80 | #include "p80211hdr.h" | ||
81 | #include "p80211mgmt.h" | ||
82 | #include "p80211conv.h" | ||
83 | #include "p80211msg.h" | ||
84 | #include "p80211netdev.h" | ||
85 | #include "p80211req.h" | ||
86 | |||
87 | /*================================================================*/ | ||
88 | /* Local Constants */ | ||
89 | |||
90 | |||
91 | /*================================================================*/ | ||
92 | /* Local Macros */ | ||
93 | |||
94 | |||
95 | /*================================================================*/ | ||
96 | /* Local Types */ | ||
97 | |||
98 | |||
99 | /*================================================================*/ | ||
100 | /* Local Static Definitions */ | ||
101 | |||
102 | static char *version = "p80211.o: " WLAN_RELEASE; | ||
103 | |||
104 | |||
105 | /*----------------------------------------------------------------*/ | ||
106 | /* --Module Parameters */ | ||
107 | |||
108 | int wlan_watchdog = 5000; | ||
109 | module_param(wlan_watchdog, int, 0644); | ||
110 | MODULE_PARM_DESC(wlan_watchdog, "transmit timeout in milliseconds"); | ||
111 | |||
112 | int wlan_wext_write = 0; | ||
113 | #if WIRELESS_EXT > 12 | ||
114 | module_param(wlan_wext_write, int, 0644); | ||
115 | MODULE_PARM_DESC(wlan_wext_write, "enable write wireless extensions"); | ||
116 | #endif | ||
117 | |||
118 | #ifdef WLAN_INCLUDE_DEBUG | ||
119 | int wlan_debug=0; | ||
120 | module_param(wlan_debug, int, 0644); | ||
121 | MODULE_PARM_DESC(wlan_debug, "p80211 debug level"); | ||
122 | #endif | ||
123 | |||
124 | MODULE_LICENSE("Dual MPL/GPL"); | ||
125 | |||
126 | /*================================================================*/ | ||
127 | /* Local Function Declarations */ | ||
128 | |||
129 | int init_module(void); | ||
130 | void cleanup_module(void); | ||
131 | |||
132 | /*================================================================*/ | ||
133 | /* Function Definitions */ | ||
134 | |||
135 | /*---------------------------------------------------------------- | ||
136 | * init_module | ||
137 | * | ||
138 | * Module initialization routine, called once at module load time. | ||
139 | * | ||
140 | * Arguments: | ||
141 | * none | ||
142 | * | ||
143 | * Returns: | ||
144 | * 0 - success | ||
145 | * ~0 - failure, module is unloaded. | ||
146 | * | ||
147 | * Side effects: | ||
148 | * TODO: define | ||
149 | * | ||
150 | * Call context: | ||
151 | * process thread (insmod or modprobe) | ||
152 | ----------------------------------------------------------------*/ | ||
153 | int init_module(void) | ||
154 | { | ||
155 | DBFENTER; | ||
156 | |||
157 | #if 0 | ||
158 | printk(KERN_NOTICE "%s (%s) Loaded\n", version, WLAN_BUILD_DATE); | ||
159 | #endif | ||
160 | |||
161 | p80211netdev_startup(); | ||
162 | #ifdef CONFIG_HOTPLUG | ||
163 | p80211_run_sbin_hotplug(NULL, WLAN_HOTPLUG_STARTUP); | ||
164 | #endif | ||
165 | |||
166 | DBFEXIT; | ||
167 | return 0; | ||
168 | } | ||
169 | |||
170 | |||
171 | /*---------------------------------------------------------------- | ||
172 | * cleanup_module | ||
173 | * | ||
174 | * Called at module unload time. This is our last chance to | ||
175 | * clean up after ourselves. | ||
176 | * | ||
177 | * Arguments: | ||
178 | * none | ||
179 | * | ||
180 | * Returns: | ||
181 | * nothing | ||
182 | * | ||
183 | * Side effects: | ||
184 | * TODO: define | ||
185 | * | ||
186 | * Call context: | ||
187 | * process thread | ||
188 | * | ||
189 | ----------------------------------------------------------------*/ | ||
190 | void cleanup_module(void) | ||
191 | { | ||
192 | DBFENTER; | ||
193 | |||
194 | #ifdef CONFIG_HOTPLUG | ||
195 | p80211_run_sbin_hotplug(NULL, WLAN_HOTPLUG_SHUTDOWN); | ||
196 | #endif | ||
197 | p80211netdev_shutdown(); | ||
198 | printk(KERN_NOTICE "%s Unloaded\n", version); | ||
199 | |||
200 | DBFEXIT; | ||
201 | return; | ||
202 | } | ||
203 | |||
204 | EXPORT_SYMBOL(p80211netdev_hwremoved); | ||
205 | EXPORT_SYMBOL(register_wlandev); | ||
206 | EXPORT_SYMBOL(p80211netdev_rx); | ||
207 | EXPORT_SYMBOL(unregister_wlandev); | ||
208 | EXPORT_SYMBOL(wlan_setup); | ||
209 | EXPORT_SYMBOL(wlan_unsetup); | ||
210 | EXPORT_SYMBOL(p80211_suspend); | ||
211 | EXPORT_SYMBOL(p80211_resume); | ||
212 | |||
213 | EXPORT_SYMBOL(p80211skb_free); | ||
214 | EXPORT_SYMBOL(p80211skb_rxmeta_attach); | ||
215 | |||
216 | EXPORT_SYMBOL(p80211wext_event_associated); | ||
diff --git a/drivers/staging/wlan-ng/p80211msg.h b/drivers/staging/wlan-ng/p80211msg.h new file mode 100644 index 000000000000..c14e9fbbd687 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211msg.h | |||
@@ -0,0 +1,102 @@ | |||
1 | /* p80211msg.h | ||
2 | * | ||
3 | * Macros, constants, types, and funcs for req and ind messages | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | */ | ||
47 | |||
48 | #ifndef _P80211MSG_H | ||
49 | #define _P80211MSG_H | ||
50 | |||
51 | /*================================================================*/ | ||
52 | /* System Includes */ | ||
53 | |||
54 | /*================================================================*/ | ||
55 | /* Project Includes */ | ||
56 | |||
57 | #ifndef _WLAN_COMPAT_H | ||
58 | #include "wlan_compat.h" | ||
59 | #endif | ||
60 | |||
61 | /*================================================================*/ | ||
62 | /* Constants */ | ||
63 | |||
64 | #define MSG_BUFF_LEN 4000 | ||
65 | #define WLAN_DEVNAMELEN_MAX 16 | ||
66 | |||
67 | /*================================================================*/ | ||
68 | /* Macros */ | ||
69 | |||
70 | /*================================================================*/ | ||
71 | /* Types */ | ||
72 | |||
73 | /*--------------------------------------------------------------------*/ | ||
74 | /*----- Message Structure Types --------------------------------------*/ | ||
75 | |||
76 | /*--------------------------------------------------------------------*/ | ||
77 | /* Prototype msg type */ | ||
78 | |||
79 | typedef struct p80211msg | ||
80 | { | ||
81 | UINT32 msgcode; | ||
82 | UINT32 msglen; | ||
83 | UINT8 devname[WLAN_DEVNAMELEN_MAX]; | ||
84 | } __WLAN_ATTRIB_PACK__ p80211msg_t; | ||
85 | |||
86 | typedef struct p80211msgd | ||
87 | { | ||
88 | UINT32 msgcode; | ||
89 | UINT32 msglen; | ||
90 | UINT8 devname[WLAN_DEVNAMELEN_MAX]; | ||
91 | UINT8 args[0]; | ||
92 | } __WLAN_ATTRIB_PACK__ p80211msgd_t; | ||
93 | |||
94 | /*================================================================*/ | ||
95 | /* Extern Declarations */ | ||
96 | |||
97 | |||
98 | /*================================================================*/ | ||
99 | /* Function Declarations */ | ||
100 | |||
101 | #endif /* _P80211MSG_H */ | ||
102 | |||
diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c new file mode 100644 index 000000000000..11f84a829e14 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211netdev.c | |||
@@ -0,0 +1,1502 @@ | |||
1 | /* src/p80211/p80211knetdev.c | ||
2 | * | ||
3 | * Linux Kernel net device interface | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * The functions required for a Linux network device are defined here. | ||
48 | * | ||
49 | * -------------------------------------------------------------------- | ||
50 | */ | ||
51 | |||
52 | |||
53 | /*================================================================*/ | ||
54 | /* System Includes */ | ||
55 | |||
56 | |||
57 | #include <linux/version.h> | ||
58 | |||
59 | #include <linux/module.h> | ||
60 | #include <linux/kernel.h> | ||
61 | #include <linux/sched.h> | ||
62 | #include <linux/types.h> | ||
63 | #include <linux/skbuff.h> | ||
64 | #include <linux/slab.h> | ||
65 | #include <linux/proc_fs.h> | ||
66 | #include <linux/interrupt.h> | ||
67 | #include <linux/netdevice.h> | ||
68 | #include <linux/kmod.h> | ||
69 | #include <linux/if_arp.h> | ||
70 | #include <linux/wireless.h> | ||
71 | #include <linux/sockios.h> | ||
72 | #include <linux/etherdevice.h> | ||
73 | |||
74 | #include <asm/bitops.h> | ||
75 | #include <asm/uaccess.h> | ||
76 | #include <asm/byteorder.h> | ||
77 | |||
78 | #ifdef SIOCETHTOOL | ||
79 | #include <linux/ethtool.h> | ||
80 | #endif | ||
81 | |||
82 | #if WIRELESS_EXT > 12 | ||
83 | #include <net/iw_handler.h> | ||
84 | #endif | ||
85 | #include <net/net_namespace.h> | ||
86 | |||
87 | /*================================================================*/ | ||
88 | /* Project Includes */ | ||
89 | |||
90 | #include "version.h" | ||
91 | #include "wlan_compat.h" | ||
92 | #include "p80211types.h" | ||
93 | #include "p80211hdr.h" | ||
94 | #include "p80211conv.h" | ||
95 | #include "p80211mgmt.h" | ||
96 | #include "p80211msg.h" | ||
97 | #include "p80211netdev.h" | ||
98 | #include "p80211ioctl.h" | ||
99 | #include "p80211req.h" | ||
100 | #include "p80211metastruct.h" | ||
101 | #include "p80211metadef.h" | ||
102 | |||
103 | /*================================================================*/ | ||
104 | /* Local Constants */ | ||
105 | |||
106 | /*================================================================*/ | ||
107 | /* Local Macros */ | ||
108 | |||
109 | |||
110 | /*================================================================*/ | ||
111 | /* Local Types */ | ||
112 | |||
113 | /*================================================================*/ | ||
114 | /* Local Static Definitions */ | ||
115 | |||
116 | #define __NO_VERSION__ /* prevent the static definition */ | ||
117 | |||
118 | #ifdef CONFIG_PROC_FS | ||
119 | static struct proc_dir_entry *proc_p80211; | ||
120 | #endif | ||
121 | |||
122 | /*================================================================*/ | ||
123 | /* Local Function Declarations */ | ||
124 | |||
125 | /* Support functions */ | ||
126 | static void p80211netdev_rx_bh(unsigned long arg); | ||
127 | |||
128 | /* netdevice method functions */ | ||
129 | static int p80211knetdev_init( netdevice_t *netdev); | ||
130 | static struct net_device_stats* p80211knetdev_get_stats(netdevice_t *netdev); | ||
131 | static int p80211knetdev_open( netdevice_t *netdev); | ||
132 | static int p80211knetdev_stop( netdevice_t *netdev ); | ||
133 | static int p80211knetdev_hard_start_xmit( struct sk_buff *skb, netdevice_t *netdev); | ||
134 | static void p80211knetdev_set_multicast_list(netdevice_t *dev); | ||
135 | static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); | ||
136 | static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr); | ||
137 | static void p80211knetdev_tx_timeout(netdevice_t *netdev); | ||
138 | static int p80211_rx_typedrop( wlandevice_t *wlandev, UINT16 fc); | ||
139 | |||
140 | #ifdef CONFIG_PROC_FS | ||
141 | static int | ||
142 | p80211netdev_proc_read( | ||
143 | char *page, | ||
144 | char **start, | ||
145 | off_t offset, | ||
146 | int count, | ||
147 | int *eof, | ||
148 | void *data); | ||
149 | #endif | ||
150 | |||
151 | /*================================================================*/ | ||
152 | /* Function Definitions */ | ||
153 | |||
154 | /*---------------------------------------------------------------- | ||
155 | * p80211knetdev_startup | ||
156 | * | ||
157 | * Initialize the wlandevice/netdevice part of 802.11 services at | ||
158 | * load time. | ||
159 | * | ||
160 | * Arguments: | ||
161 | * none | ||
162 | * | ||
163 | * Returns: | ||
164 | * nothing | ||
165 | ----------------------------------------------------------------*/ | ||
166 | void p80211netdev_startup(void) | ||
167 | { | ||
168 | DBFENTER; | ||
169 | |||
170 | #ifdef CONFIG_PROC_FS | ||
171 | if (init_net.proc_net != NULL) { | ||
172 | proc_p80211 = create_proc_entry( | ||
173 | "p80211", | ||
174 | (S_IFDIR|S_IRUGO|S_IXUGO), | ||
175 | init_net.proc_net); | ||
176 | } | ||
177 | #endif | ||
178 | DBFEXIT; | ||
179 | return; | ||
180 | } | ||
181 | |||
182 | /*---------------------------------------------------------------- | ||
183 | * p80211knetdev_shutdown | ||
184 | * | ||
185 | * Shutdown the wlandevice/netdevice part of 802.11 services at | ||
186 | * unload time. | ||
187 | * | ||
188 | * Arguments: | ||
189 | * none | ||
190 | * | ||
191 | * Returns: | ||
192 | * nothing | ||
193 | ----------------------------------------------------------------*/ | ||
194 | void | ||
195 | p80211netdev_shutdown(void) | ||
196 | { | ||
197 | DBFENTER; | ||
198 | #ifdef CONFIG_PROC_FS | ||
199 | if (proc_p80211 != NULL) { | ||
200 | remove_proc_entry("p80211", init_net.proc_net); | ||
201 | } | ||
202 | #endif | ||
203 | DBFEXIT; | ||
204 | } | ||
205 | |||
206 | /*---------------------------------------------------------------- | ||
207 | * p80211knetdev_init | ||
208 | * | ||
209 | * Init method for a Linux netdevice. Called in response to | ||
210 | * register_netdev. | ||
211 | * | ||
212 | * Arguments: | ||
213 | * none | ||
214 | * | ||
215 | * Returns: | ||
216 | * nothing | ||
217 | ----------------------------------------------------------------*/ | ||
218 | static int p80211knetdev_init( netdevice_t *netdev) | ||
219 | { | ||
220 | DBFENTER; | ||
221 | /* Called in response to register_netdev */ | ||
222 | /* This is usually the probe function, but the probe has */ | ||
223 | /* already been done by the MSD and the create_kdev */ | ||
224 | /* function. All we do here is return success */ | ||
225 | DBFEXIT; | ||
226 | return 0; | ||
227 | } | ||
228 | |||
229 | |||
230 | /*---------------------------------------------------------------- | ||
231 | * p80211knetdev_get_stats | ||
232 | * | ||
233 | * Statistics retrieval for linux netdevices. Here we're reporting | ||
234 | * the Linux i/f level statistics. Hence, for the primary numbers, | ||
235 | * we don't want to report the numbers from the MIB. Eventually, | ||
236 | * it might be useful to collect some of the error counters though. | ||
237 | * | ||
238 | * Arguments: | ||
239 | * netdev Linux netdevice | ||
240 | * | ||
241 | * Returns: | ||
242 | * the address of the statistics structure | ||
243 | ----------------------------------------------------------------*/ | ||
244 | static struct net_device_stats* | ||
245 | p80211knetdev_get_stats(netdevice_t *netdev) | ||
246 | { | ||
247 | wlandevice_t *wlandev = (wlandevice_t*)netdev->priv; | ||
248 | DBFENTER; | ||
249 | |||
250 | /* TODO: review the MIB stats for items that correspond to | ||
251 | linux stats */ | ||
252 | |||
253 | DBFEXIT; | ||
254 | return &(wlandev->linux_stats); | ||
255 | } | ||
256 | |||
257 | |||
258 | /*---------------------------------------------------------------- | ||
259 | * p80211knetdev_open | ||
260 | * | ||
261 | * Linux netdevice open method. Following a successful call here, | ||
262 | * the device is supposed to be ready for tx and rx. In our | ||
263 | * situation that may not be entirely true due to the state of the | ||
264 | * MAC below. | ||
265 | * | ||
266 | * Arguments: | ||
267 | * netdev Linux network device structure | ||
268 | * | ||
269 | * Returns: | ||
270 | * zero on success, non-zero otherwise | ||
271 | ----------------------------------------------------------------*/ | ||
272 | static int p80211knetdev_open( netdevice_t *netdev ) | ||
273 | { | ||
274 | int result = 0; /* success */ | ||
275 | wlandevice_t *wlandev = (wlandevice_t*)(netdev->priv); | ||
276 | |||
277 | DBFENTER; | ||
278 | |||
279 | /* Check to make sure the MSD is running */ | ||
280 | if ( wlandev->msdstate != WLAN_MSD_RUNNING ) { | ||
281 | return -ENODEV; | ||
282 | } | ||
283 | |||
284 | /* Tell the MSD to open */ | ||
285 | if ( wlandev->open != NULL) { | ||
286 | result = wlandev->open(wlandev); | ||
287 | if ( result == 0 ) { | ||
288 | #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,3,43) ) | ||
289 | netdev->interrupt = 0; | ||
290 | #endif | ||
291 | p80211netdev_start_queue(wlandev); | ||
292 | wlandev->state = WLAN_DEVICE_OPEN; | ||
293 | } | ||
294 | } else { | ||
295 | result = -EAGAIN; | ||
296 | } | ||
297 | |||
298 | DBFEXIT; | ||
299 | return result; | ||
300 | } | ||
301 | |||
302 | |||
303 | /*---------------------------------------------------------------- | ||
304 | * p80211knetdev_stop | ||
305 | * | ||
306 | * Linux netdevice stop (close) method. Following this call, | ||
307 | * no frames should go up or down through this interface. | ||
308 | * | ||
309 | * Arguments: | ||
310 | * netdev Linux network device structure | ||
311 | * | ||
312 | * Returns: | ||
313 | * zero on success, non-zero otherwise | ||
314 | ----------------------------------------------------------------*/ | ||
315 | static int p80211knetdev_stop( netdevice_t *netdev ) | ||
316 | { | ||
317 | int result = 0; | ||
318 | wlandevice_t *wlandev = (wlandevice_t*)(netdev->priv); | ||
319 | |||
320 | DBFENTER; | ||
321 | |||
322 | if ( wlandev->close != NULL ) { | ||
323 | result = wlandev->close(wlandev); | ||
324 | } | ||
325 | |||
326 | p80211netdev_stop_queue(wlandev); | ||
327 | wlandev->state = WLAN_DEVICE_CLOSED; | ||
328 | |||
329 | DBFEXIT; | ||
330 | return result; | ||
331 | } | ||
332 | |||
333 | /*---------------------------------------------------------------- | ||
334 | * p80211netdev_rx | ||
335 | * | ||
336 | * Frame receive function called by the mac specific driver. | ||
337 | * | ||
338 | * Arguments: | ||
339 | * wlandev WLAN network device structure | ||
340 | * skb skbuff containing a full 802.11 frame. | ||
341 | * Returns: | ||
342 | * nothing | ||
343 | * Side effects: | ||
344 | * | ||
345 | ----------------------------------------------------------------*/ | ||
346 | void | ||
347 | p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb ) | ||
348 | { | ||
349 | DBFENTER; | ||
350 | |||
351 | /* Enqueue for post-irq processing */ | ||
352 | skb_queue_tail(&wlandev->nsd_rxq, skb); | ||
353 | |||
354 | tasklet_schedule(&wlandev->rx_bh); | ||
355 | |||
356 | DBFEXIT; | ||
357 | return; | ||
358 | } | ||
359 | |||
360 | /*---------------------------------------------------------------- | ||
361 | * p80211netdev_rx_bh | ||
362 | * | ||
363 | * Deferred processing of all received frames. | ||
364 | * | ||
365 | * Arguments: | ||
366 | * wlandev WLAN network device structure | ||
367 | * skb skbuff containing a full 802.11 frame. | ||
368 | * Returns: | ||
369 | * nothing | ||
370 | * Side effects: | ||
371 | * | ||
372 | ----------------------------------------------------------------*/ | ||
373 | static void p80211netdev_rx_bh(unsigned long arg) | ||
374 | { | ||
375 | wlandevice_t *wlandev = (wlandevice_t *) arg; | ||
376 | struct sk_buff *skb = NULL; | ||
377 | netdevice_t *dev = wlandev->netdev; | ||
378 | p80211_hdr_a3_t *hdr; | ||
379 | UINT16 fc; | ||
380 | |||
381 | DBFENTER; | ||
382 | |||
383 | /* Let's empty our our queue */ | ||
384 | while ( (skb = skb_dequeue(&wlandev->nsd_rxq)) ) { | ||
385 | if (wlandev->state == WLAN_DEVICE_OPEN) { | ||
386 | |||
387 | if (dev->type != ARPHRD_ETHER) { | ||
388 | /* RAW frame; we shouldn't convert it */ | ||
389 | // XXX Append the Prism Header here instead. | ||
390 | |||
391 | /* set up various data fields */ | ||
392 | skb->dev = dev; | ||
393 | skb_reset_mac_header(skb); | ||
394 | skb->ip_summed = CHECKSUM_NONE; | ||
395 | skb->pkt_type = PACKET_OTHERHOST; | ||
396 | skb->protocol = htons(ETH_P_80211_RAW); | ||
397 | dev->last_rx = jiffies; | ||
398 | |||
399 | wlandev->linux_stats.rx_packets++; | ||
400 | wlandev->linux_stats.rx_bytes += skb->len; | ||
401 | netif_rx_ni(skb); | ||
402 | continue; | ||
403 | } else { | ||
404 | hdr = (p80211_hdr_a3_t *)skb->data; | ||
405 | fc = ieee2host16(hdr->fc); | ||
406 | if (p80211_rx_typedrop(wlandev, fc)) { | ||
407 | dev_kfree_skb(skb); | ||
408 | continue; | ||
409 | } | ||
410 | |||
411 | /* perform mcast filtering */ | ||
412 | if (wlandev->netdev->flags & IFF_ALLMULTI) { | ||
413 | /* allow my local address through */ | ||
414 | if (memcmp(hdr->a1, wlandev->netdev->dev_addr, WLAN_ADDR_LEN) != 0) { | ||
415 | /* but reject anything else that isn't multicast */ | ||
416 | if (!(hdr->a1[0] & 0x01)) { | ||
417 | dev_kfree_skb(skb); | ||
418 | continue; | ||
419 | } | ||
420 | } | ||
421 | } | ||
422 | |||
423 | if ( skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0 ) { | ||
424 | skb->dev->last_rx = jiffies; | ||
425 | wlandev->linux_stats.rx_packets++; | ||
426 | wlandev->linux_stats.rx_bytes += skb->len; | ||
427 | netif_rx_ni(skb); | ||
428 | continue; | ||
429 | } | ||
430 | WLAN_LOG_DEBUG(1, "p80211_to_ether failed.\n"); | ||
431 | } | ||
432 | } | ||
433 | dev_kfree_skb(skb); | ||
434 | } | ||
435 | |||
436 | DBFEXIT; | ||
437 | } | ||
438 | |||
439 | |||
440 | /*---------------------------------------------------------------- | ||
441 | * p80211knetdev_hard_start_xmit | ||
442 | * | ||
443 | * Linux netdevice method for transmitting a frame. | ||
444 | * | ||
445 | * Arguments: | ||
446 | * skb Linux sk_buff containing the frame. | ||
447 | * netdev Linux netdevice. | ||
448 | * | ||
449 | * Side effects: | ||
450 | * If the lower layers report that buffers are full. netdev->tbusy | ||
451 | * will be set to prevent higher layers from sending more traffic. | ||
452 | * | ||
453 | * Note: If this function returns non-zero, higher layers retain | ||
454 | * ownership of the skb. | ||
455 | * | ||
456 | * Returns: | ||
457 | * zero on success, non-zero on failure. | ||
458 | ----------------------------------------------------------------*/ | ||
459 | static int p80211knetdev_hard_start_xmit( struct sk_buff *skb, netdevice_t *netdev) | ||
460 | { | ||
461 | int result = 0; | ||
462 | int txresult = -1; | ||
463 | wlandevice_t *wlandev = (wlandevice_t*)netdev->priv; | ||
464 | p80211_hdr_t p80211_hdr; | ||
465 | p80211_metawep_t p80211_wep; | ||
466 | |||
467 | DBFENTER; | ||
468 | |||
469 | if (skb == NULL) { | ||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | if (wlandev->state != WLAN_DEVICE_OPEN) { | ||
474 | result = 1; | ||
475 | goto failed; | ||
476 | } | ||
477 | |||
478 | memset(&p80211_hdr, 0, sizeof(p80211_hdr_t)); | ||
479 | memset(&p80211_wep, 0, sizeof(p80211_metawep_t)); | ||
480 | |||
481 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) ) | ||
482 | if ( test_and_set_bit(0, (void*)&(netdev->tbusy)) != 0 ) { | ||
483 | /* We've been called w/ tbusy set, has the tx */ | ||
484 | /* path stalled? */ | ||
485 | WLAN_LOG_DEBUG(1, "called when tbusy set\n"); | ||
486 | result = 1; | ||
487 | goto failed; | ||
488 | } | ||
489 | #else | ||
490 | if ( netif_queue_stopped(netdev) ) { | ||
491 | WLAN_LOG_DEBUG(1, "called when queue stopped.\n"); | ||
492 | result = 1; | ||
493 | goto failed; | ||
494 | } | ||
495 | |||
496 | netif_stop_queue(netdev); | ||
497 | |||
498 | /* No timeout handling here, 2.3.38+ kernels call the | ||
499 | * timeout function directly. | ||
500 | * TODO: Add timeout handling. | ||
501 | */ | ||
502 | #endif | ||
503 | |||
504 | /* Check to see that a valid mode is set */ | ||
505 | switch( wlandev->macmode ) { | ||
506 | case WLAN_MACMODE_IBSS_STA: | ||
507 | case WLAN_MACMODE_ESS_STA: | ||
508 | case WLAN_MACMODE_ESS_AP: | ||
509 | break; | ||
510 | default: | ||
511 | /* Mode isn't set yet, just drop the frame | ||
512 | * and return success . | ||
513 | * TODO: we need a saner way to handle this | ||
514 | */ | ||
515 | if(skb->protocol != ETH_P_80211_RAW) { | ||
516 | p80211netdev_start_queue(wlandev); | ||
517 | WLAN_LOG_NOTICE( | ||
518 | "Tx attempt prior to association, frame dropped.\n"); | ||
519 | wlandev->linux_stats.tx_dropped++; | ||
520 | result = 0; | ||
521 | goto failed; | ||
522 | } | ||
523 | break; | ||
524 | } | ||
525 | |||
526 | /* Check for raw transmits */ | ||
527 | if(skb->protocol == ETH_P_80211_RAW) { | ||
528 | if (!capable(CAP_NET_ADMIN)) { | ||
529 | result = 1; | ||
530 | goto failed; | ||
531 | } | ||
532 | /* move the header over */ | ||
533 | memcpy(&p80211_hdr, skb->data, sizeof(p80211_hdr_t)); | ||
534 | skb_pull(skb, sizeof(p80211_hdr_t)); | ||
535 | } else { | ||
536 | if ( skb_ether_to_p80211(wlandev, wlandev->ethconv, skb, &p80211_hdr, &p80211_wep) != 0 ) { | ||
537 | /* convert failed */ | ||
538 | WLAN_LOG_DEBUG(1, "ether_to_80211(%d) failed.\n", | ||
539 | wlandev->ethconv); | ||
540 | result = 1; | ||
541 | goto failed; | ||
542 | } | ||
543 | } | ||
544 | if ( wlandev->txframe == NULL ) { | ||
545 | result = 1; | ||
546 | goto failed; | ||
547 | } | ||
548 | |||
549 | netdev->trans_start = jiffies; | ||
550 | |||
551 | wlandev->linux_stats.tx_packets++; | ||
552 | /* count only the packet payload */ | ||
553 | wlandev->linux_stats.tx_bytes += skb->len; | ||
554 | |||
555 | txresult = wlandev->txframe(wlandev, skb, &p80211_hdr, &p80211_wep); | ||
556 | |||
557 | if ( txresult == 0) { | ||
558 | /* success and more buf */ | ||
559 | /* avail, re: hw_txdata */ | ||
560 | p80211netdev_wake_queue(wlandev); | ||
561 | result = 0; | ||
562 | } else if ( txresult == 1 ) { | ||
563 | /* success, no more avail */ | ||
564 | WLAN_LOG_DEBUG(3, "txframe success, no more bufs\n"); | ||
565 | /* netdev->tbusy = 1; don't set here, irqhdlr */ | ||
566 | /* may have already cleared it */ | ||
567 | result = 0; | ||
568 | } else if ( txresult == 2 ) { | ||
569 | /* alloc failure, drop frame */ | ||
570 | WLAN_LOG_DEBUG(3, "txframe returned alloc_fail\n"); | ||
571 | result = 1; | ||
572 | } else { | ||
573 | /* buffer full or queue busy, drop frame. */ | ||
574 | WLAN_LOG_DEBUG(3, "txframe returned full or busy\n"); | ||
575 | result = 1; | ||
576 | } | ||
577 | |||
578 | failed: | ||
579 | /* Free up the WEP buffer if it's not the same as the skb */ | ||
580 | if ((p80211_wep.data) && (p80211_wep.data != skb->data)) | ||
581 | kfree(p80211_wep.data); | ||
582 | |||
583 | /* we always free the skb here, never in a lower level. */ | ||
584 | if (!result) | ||
585 | dev_kfree_skb(skb); | ||
586 | |||
587 | DBFEXIT; | ||
588 | return result; | ||
589 | } | ||
590 | |||
591 | |||
592 | /*---------------------------------------------------------------- | ||
593 | * p80211knetdev_set_multicast_list | ||
594 | * | ||
595 | * Called from higher lavers whenever there's a need to set/clear | ||
596 | * promiscuous mode or rewrite the multicast list. | ||
597 | * | ||
598 | * Arguments: | ||
599 | * none | ||
600 | * | ||
601 | * Returns: | ||
602 | * nothing | ||
603 | ----------------------------------------------------------------*/ | ||
604 | static void p80211knetdev_set_multicast_list(netdevice_t *dev) | ||
605 | { | ||
606 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
607 | |||
608 | DBFENTER; | ||
609 | |||
610 | /* TODO: real multicast support as well */ | ||
611 | |||
612 | if (wlandev->set_multicast_list) | ||
613 | wlandev->set_multicast_list(wlandev, dev); | ||
614 | |||
615 | DBFEXIT; | ||
616 | } | ||
617 | |||
618 | #ifdef SIOCETHTOOL | ||
619 | |||
620 | static int p80211netdev_ethtool(wlandevice_t *wlandev, void __user *useraddr) | ||
621 | { | ||
622 | UINT32 ethcmd; | ||
623 | struct ethtool_drvinfo info; | ||
624 | struct ethtool_value edata; | ||
625 | |||
626 | memset(&info, 0, sizeof(info)); | ||
627 | memset(&edata, 0, sizeof(edata)); | ||
628 | |||
629 | if (copy_from_user(ðcmd, useraddr, sizeof(ethcmd))) | ||
630 | return -EFAULT; | ||
631 | |||
632 | switch (ethcmd) { | ||
633 | case ETHTOOL_GDRVINFO: | ||
634 | info.cmd = ethcmd; | ||
635 | snprintf(info.driver, sizeof(info.driver), "p80211_%s", | ||
636 | wlandev->nsdname); | ||
637 | snprintf(info.version, sizeof(info.version), "%s", | ||
638 | WLAN_RELEASE); | ||
639 | |||
640 | // info.fw_version | ||
641 | // info.bus_info | ||
642 | |||
643 | if (copy_to_user(useraddr, &info, sizeof(info))) | ||
644 | return -EFAULT; | ||
645 | return 0; | ||
646 | #ifdef ETHTOOL_GLINK | ||
647 | case ETHTOOL_GLINK: | ||
648 | edata.cmd = ethcmd; | ||
649 | |||
650 | if (wlandev->linkstatus && | ||
651 | (wlandev->macmode != WLAN_MACMODE_NONE)) { | ||
652 | edata.data = 1; | ||
653 | } else { | ||
654 | edata.data = 0; | ||
655 | } | ||
656 | |||
657 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | ||
658 | return -EFAULT; | ||
659 | return 0; | ||
660 | } | ||
661 | #endif | ||
662 | |||
663 | return -EOPNOTSUPP; | ||
664 | } | ||
665 | |||
666 | #endif | ||
667 | |||
668 | /*---------------------------------------------------------------- | ||
669 | * p80211knetdev_do_ioctl | ||
670 | * | ||
671 | * Handle an ioctl call on one of our devices. Everything Linux | ||
672 | * ioctl specific is done here. Then we pass the contents of the | ||
673 | * ifr->data to the request message handler. | ||
674 | * | ||
675 | * Arguments: | ||
676 | * dev Linux kernel netdevice | ||
677 | * ifr Our private ioctl request structure, typed for the | ||
678 | * generic struct ifreq so we can use ptr to func | ||
679 | * w/o cast. | ||
680 | * | ||
681 | * Returns: | ||
682 | * zero on success, a negative errno on failure. Possible values: | ||
683 | * -ENETDOWN Device isn't up. | ||
684 | * -EBUSY cmd already in progress | ||
685 | * -ETIME p80211 cmd timed out (MSD may have its own timers) | ||
686 | * -EFAULT memory fault copying msg from user buffer | ||
687 | * -ENOMEM unable to allocate kernel msg buffer | ||
688 | * -ENOSYS bad magic, it the cmd really for us? | ||
689 | * -EINTR sleeping on cmd, awakened by signal, cmd cancelled. | ||
690 | * | ||
691 | * Call Context: | ||
692 | * Process thread (ioctl caller). TODO: SMP support may require | ||
693 | * locks. | ||
694 | ----------------------------------------------------------------*/ | ||
695 | static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) | ||
696 | { | ||
697 | int result = 0; | ||
698 | p80211ioctl_req_t *req = (p80211ioctl_req_t*)ifr; | ||
699 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
700 | UINT8 *msgbuf; | ||
701 | DBFENTER; | ||
702 | |||
703 | WLAN_LOG_DEBUG(2, "rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len); | ||
704 | |||
705 | #if WIRELESS_EXT < 13 | ||
706 | /* Is this a wireless extensions ioctl? */ | ||
707 | if ((cmd >= SIOCIWFIRST) && (cmd <= SIOCIWLAST)) { | ||
708 | if ((result = p80211wext_support_ioctl(dev, ifr, cmd)) | ||
709 | != (-EOPNOTSUPP)) { | ||
710 | goto bail; | ||
711 | } | ||
712 | } | ||
713 | #endif | ||
714 | |||
715 | #ifdef SIOCETHTOOL | ||
716 | if (cmd == SIOCETHTOOL) { | ||
717 | result = p80211netdev_ethtool(wlandev, (void __user *) ifr->ifr_data); | ||
718 | goto bail; | ||
719 | } | ||
720 | #endif | ||
721 | |||
722 | /* Test the magic, assume ifr is good if it's there */ | ||
723 | if ( req->magic != P80211_IOCTL_MAGIC ) { | ||
724 | result = -ENOSYS; | ||
725 | goto bail; | ||
726 | } | ||
727 | |||
728 | if ( cmd == P80211_IFTEST ) { | ||
729 | result = 0; | ||
730 | goto bail; | ||
731 | } else if ( cmd != P80211_IFREQ ) { | ||
732 | result = -ENOSYS; | ||
733 | goto bail; | ||
734 | } | ||
735 | |||
736 | /* Allocate a buf of size req->len */ | ||
737 | if ((msgbuf = kmalloc( req->len, GFP_KERNEL))) { | ||
738 | if ( copy_from_user( msgbuf, (void __user *) req->data, req->len) ) { | ||
739 | result = -EFAULT; | ||
740 | } else { | ||
741 | result = p80211req_dorequest( wlandev, msgbuf); | ||
742 | } | ||
743 | |||
744 | if ( result == 0 ) { | ||
745 | if ( copy_to_user( (void __user *) req->data, msgbuf, req->len)) { | ||
746 | result = -EFAULT; | ||
747 | } | ||
748 | } | ||
749 | kfree(msgbuf); | ||
750 | } else { | ||
751 | result = -ENOMEM; | ||
752 | } | ||
753 | bail: | ||
754 | DBFEXIT; | ||
755 | |||
756 | return result; /* If allocate,copyfrom or copyto fails, return errno */ | ||
757 | } | ||
758 | |||
759 | /*---------------------------------------------------------------- | ||
760 | * p80211knetdev_set_mac_address | ||
761 | * | ||
762 | * Handles the ioctl for changing the MACAddress of a netdevice | ||
763 | * | ||
764 | * references: linux/netdevice.h and drivers/net/net_init.c | ||
765 | * | ||
766 | * NOTE: [MSM] We only prevent address changes when the netdev is | ||
767 | * up. We don't control anything based on dot11 state. If the | ||
768 | * address is changed on a STA that's currently associated, you | ||
769 | * will probably lose the ability to send and receive data frames. | ||
770 | * Just be aware. Therefore, this should usually only be done | ||
771 | * prior to scan/join/auth/assoc. | ||
772 | * | ||
773 | * Arguments: | ||
774 | * dev netdevice struct | ||
775 | * addr the new MACAddress (a struct) | ||
776 | * | ||
777 | * Returns: | ||
778 | * zero on success, a negative errno on failure. Possible values: | ||
779 | * -EBUSY device is bussy (cmd not possible) | ||
780 | * -and errors returned by: p80211req_dorequest(..) | ||
781 | * | ||
782 | * by: Collin R. Mulliner <collin@mulliner.org> | ||
783 | ----------------------------------------------------------------*/ | ||
784 | static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr) | ||
785 | { | ||
786 | struct sockaddr *new_addr = addr; | ||
787 | p80211msg_dot11req_mibset_t dot11req; | ||
788 | p80211item_unk392_t *mibattr; | ||
789 | p80211item_pstr6_t *macaddr; | ||
790 | p80211item_uint32_t *resultcode; | ||
791 | int result = 0; | ||
792 | |||
793 | DBFENTER; | ||
794 | /* If we're running, we don't allow MAC address changes */ | ||
795 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) ) | ||
796 | if ( dev->start) { | ||
797 | return -EBUSY; | ||
798 | } | ||
799 | #else | ||
800 | if (netif_running(dev)) { | ||
801 | return -EBUSY; | ||
802 | } | ||
803 | #endif | ||
804 | |||
805 | /* Set up some convenience pointers. */ | ||
806 | mibattr = &dot11req.mibattribute; | ||
807 | macaddr = (p80211item_pstr6_t*)&mibattr->data; | ||
808 | resultcode = &dot11req.resultcode; | ||
809 | |||
810 | /* Set up a dot11req_mibset */ | ||
811 | memset(&dot11req, 0, sizeof(p80211msg_dot11req_mibset_t)); | ||
812 | dot11req.msgcode = DIDmsg_dot11req_mibset; | ||
813 | dot11req.msglen = sizeof(p80211msg_dot11req_mibset_t); | ||
814 | memcpy(dot11req.devname, | ||
815 | ((wlandevice_t*)(dev->priv))->name, | ||
816 | WLAN_DEVNAMELEN_MAX - 1); | ||
817 | |||
818 | /* Set up the mibattribute argument */ | ||
819 | mibattr->did = DIDmsg_dot11req_mibset_mibattribute; | ||
820 | mibattr->status = P80211ENUM_msgitem_status_data_ok; | ||
821 | mibattr->len = sizeof(mibattr->data); | ||
822 | |||
823 | macaddr->did = DIDmib_dot11mac_dot11OperationTable_dot11MACAddress; | ||
824 | macaddr->status = P80211ENUM_msgitem_status_data_ok; | ||
825 | macaddr->len = sizeof(macaddr->data); | ||
826 | macaddr->data.len = WLAN_ADDR_LEN; | ||
827 | memcpy(&macaddr->data.data, new_addr->sa_data, WLAN_ADDR_LEN); | ||
828 | |||
829 | /* Set up the resultcode argument */ | ||
830 | resultcode->did = DIDmsg_dot11req_mibset_resultcode; | ||
831 | resultcode->status = P80211ENUM_msgitem_status_no_value; | ||
832 | resultcode->len = sizeof(resultcode->data); | ||
833 | resultcode->data = 0; | ||
834 | |||
835 | /* now fire the request */ | ||
836 | result = p80211req_dorequest(dev->priv, (UINT8*)&dot11req); | ||
837 | |||
838 | /* If the request wasn't successful, report an error and don't | ||
839 | * change the netdev address | ||
840 | */ | ||
841 | if ( result != 0 || resultcode->data != P80211ENUM_resultcode_success) { | ||
842 | WLAN_LOG_ERROR( | ||
843 | "Low-level driver failed dot11req_mibset(dot11MACAddress).\n"); | ||
844 | result = -EADDRNOTAVAIL; | ||
845 | } else { | ||
846 | /* everything's ok, change the addr in netdev */ | ||
847 | memcpy(dev->dev_addr, new_addr->sa_data, dev->addr_len); | ||
848 | } | ||
849 | |||
850 | DBFEXIT; | ||
851 | return result; | ||
852 | } | ||
853 | |||
854 | static int wlan_change_mtu(netdevice_t *dev, int new_mtu) | ||
855 | { | ||
856 | DBFENTER; | ||
857 | // 2312 is max 802.11 payload, 20 is overhead, (ether + llc +snap) | ||
858 | // and another 8 for wep. | ||
859 | if ( (new_mtu < 68) || (new_mtu > (2312 - 20 - 8))) | ||
860 | return -EINVAL; | ||
861 | |||
862 | dev->mtu = new_mtu; | ||
863 | |||
864 | DBFEXIT; | ||
865 | |||
866 | return 0; | ||
867 | } | ||
868 | |||
869 | |||
870 | |||
871 | /*---------------------------------------------------------------- | ||
872 | * wlan_setup | ||
873 | * | ||
874 | * Roughly matches the functionality of ether_setup. Here | ||
875 | * we set up any members of the wlandevice structure that are common | ||
876 | * to all devices. Additionally, we allocate a linux 'struct device' | ||
877 | * and perform the same setup as ether_setup. | ||
878 | * | ||
879 | * Note: It's important that the caller have setup the wlandev->name | ||
880 | * ptr prior to calling this function. | ||
881 | * | ||
882 | * Arguments: | ||
883 | * wlandev ptr to the wlandev structure for the | ||
884 | * interface. | ||
885 | * Returns: | ||
886 | * zero on success, non-zero otherwise. | ||
887 | * Call Context: | ||
888 | * Should be process thread. We'll assume it might be | ||
889 | * interrupt though. When we add support for statically | ||
890 | * compiled drivers, this function will be called in the | ||
891 | * context of the kernel startup code. | ||
892 | ----------------------------------------------------------------*/ | ||
893 | int wlan_setup(wlandevice_t *wlandev) | ||
894 | { | ||
895 | int result = 0; | ||
896 | netdevice_t *dev; | ||
897 | |||
898 | DBFENTER; | ||
899 | |||
900 | /* Set up the wlandev */ | ||
901 | wlandev->state = WLAN_DEVICE_CLOSED; | ||
902 | wlandev->ethconv = WLAN_ETHCONV_8021h; | ||
903 | wlandev->macmode = WLAN_MACMODE_NONE; | ||
904 | |||
905 | /* Set up the rx queue */ | ||
906 | skb_queue_head_init(&wlandev->nsd_rxq); | ||
907 | tasklet_init(&wlandev->rx_bh, | ||
908 | p80211netdev_rx_bh, | ||
909 | (unsigned long)wlandev); | ||
910 | |||
911 | /* Allocate and initialize the struct device */ | ||
912 | dev = kmalloc(sizeof(netdevice_t), GFP_ATOMIC); | ||
913 | if ( dev == NULL ) { | ||
914 | WLAN_LOG_ERROR("Failed to alloc netdev.\n"); | ||
915 | result = 1; | ||
916 | } else { | ||
917 | memset( dev, 0, sizeof(netdevice_t)); | ||
918 | ether_setup(dev); | ||
919 | wlandev->netdev = dev; | ||
920 | dev->priv = wlandev; | ||
921 | dev->hard_start_xmit = p80211knetdev_hard_start_xmit; | ||
922 | dev->get_stats = p80211knetdev_get_stats; | ||
923 | #ifdef HAVE_PRIVATE_IOCTL | ||
924 | dev->do_ioctl = p80211knetdev_do_ioctl; | ||
925 | #endif | ||
926 | #ifdef HAVE_MULTICAST | ||
927 | dev->set_multicast_list = p80211knetdev_set_multicast_list; | ||
928 | #endif | ||
929 | dev->init = p80211knetdev_init; | ||
930 | dev->open = p80211knetdev_open; | ||
931 | dev->stop = p80211knetdev_stop; | ||
932 | |||
933 | #ifdef CONFIG_NET_WIRELESS | ||
934 | #if ((WIRELESS_EXT < 17) && (WIRELESS_EXT < 21)) | ||
935 | dev->get_wireless_stats = p80211wext_get_wireless_stats; | ||
936 | #endif | ||
937 | #if WIRELESS_EXT > 12 | ||
938 | dev->wireless_handlers = &p80211wext_handler_def; | ||
939 | #endif | ||
940 | #endif | ||
941 | |||
942 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) ) | ||
943 | dev->tbusy = 1; | ||
944 | dev->start = 0; | ||
945 | #else | ||
946 | netif_stop_queue(dev); | ||
947 | #endif | ||
948 | #ifdef HAVE_CHANGE_MTU | ||
949 | dev->change_mtu = wlan_change_mtu; | ||
950 | #endif | ||
951 | #ifdef HAVE_SET_MAC_ADDR | ||
952 | dev->set_mac_address = p80211knetdev_set_mac_address; | ||
953 | #endif | ||
954 | #ifdef HAVE_TX_TIMEOUT | ||
955 | dev->tx_timeout = &p80211knetdev_tx_timeout; | ||
956 | dev->watchdog_timeo = (wlan_watchdog * HZ) / 1000; | ||
957 | #endif | ||
958 | netif_carrier_off(dev); | ||
959 | } | ||
960 | |||
961 | DBFEXIT; | ||
962 | return result; | ||
963 | } | ||
964 | |||
965 | /*---------------------------------------------------------------- | ||
966 | * wlan_unsetup | ||
967 | * | ||
968 | * This function is paired with the wlan_setup routine. It should | ||
969 | * be called after unregister_wlandev. Basically, all it does is | ||
970 | * free the 'struct device' that's associated with the wlandev. | ||
971 | * We do it here because the 'struct device' isn't allocated | ||
972 | * explicitly in the driver code, it's done in wlan_setup. To | ||
973 | * do the free in the driver might seem like 'magic'. | ||
974 | * | ||
975 | * Arguments: | ||
976 | * wlandev ptr to the wlandev structure for the | ||
977 | * interface. | ||
978 | * Returns: | ||
979 | * zero on success, non-zero otherwise. | ||
980 | * Call Context: | ||
981 | * Should be process thread. We'll assume it might be | ||
982 | * interrupt though. When we add support for statically | ||
983 | * compiled drivers, this function will be called in the | ||
984 | * context of the kernel startup code. | ||
985 | ----------------------------------------------------------------*/ | ||
986 | int wlan_unsetup(wlandevice_t *wlandev) | ||
987 | { | ||
988 | int result = 0; | ||
989 | |||
990 | DBFENTER; | ||
991 | |||
992 | tasklet_kill(&wlandev->rx_bh); | ||
993 | |||
994 | if (wlandev->netdev == NULL ) { | ||
995 | WLAN_LOG_ERROR("called without wlandev->netdev set.\n"); | ||
996 | result = 1; | ||
997 | } else { | ||
998 | free_netdev(wlandev->netdev); | ||
999 | wlandev->netdev = NULL; | ||
1000 | } | ||
1001 | |||
1002 | DBFEXIT; | ||
1003 | return 0; | ||
1004 | } | ||
1005 | |||
1006 | |||
1007 | |||
1008 | /*---------------------------------------------------------------- | ||
1009 | * register_wlandev | ||
1010 | * | ||
1011 | * Roughly matches the functionality of register_netdev. This function | ||
1012 | * is called after the driver has successfully probed and set up the | ||
1013 | * resources for the device. It's now ready to become a named device | ||
1014 | * in the Linux system. | ||
1015 | * | ||
1016 | * First we allocate a name for the device (if not already set), then | ||
1017 | * we call the Linux function register_netdevice. | ||
1018 | * | ||
1019 | * Arguments: | ||
1020 | * wlandev ptr to the wlandev structure for the | ||
1021 | * interface. | ||
1022 | * Returns: | ||
1023 | * zero on success, non-zero otherwise. | ||
1024 | * Call Context: | ||
1025 | * Can be either interrupt or not. | ||
1026 | ----------------------------------------------------------------*/ | ||
1027 | int register_wlandev(wlandevice_t *wlandev) | ||
1028 | { | ||
1029 | int i = 0; | ||
1030 | netdevice_t *dev = wlandev->netdev; | ||
1031 | |||
1032 | DBFENTER; | ||
1033 | |||
1034 | i = dev_alloc_name(wlandev->netdev, "wlan%d"); | ||
1035 | if (i >= 0) { | ||
1036 | i = register_netdev(wlandev->netdev); | ||
1037 | } | ||
1038 | if (i != 0) { | ||
1039 | return -EIO; | ||
1040 | } | ||
1041 | |||
1042 | #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) ) | ||
1043 | dev->name = wlandev->name; | ||
1044 | #else | ||
1045 | strcpy(wlandev->name, dev->name); | ||
1046 | #endif | ||
1047 | |||
1048 | #ifdef CONFIG_PROC_FS | ||
1049 | if (proc_p80211) { | ||
1050 | wlandev->procdir = proc_mkdir(wlandev->name, proc_p80211); | ||
1051 | if ( wlandev->procdir ) | ||
1052 | wlandev->procwlandev = | ||
1053 | create_proc_read_entry("wlandev", 0, | ||
1054 | wlandev->procdir, | ||
1055 | p80211netdev_proc_read, | ||
1056 | wlandev); | ||
1057 | if (wlandev->nsd_proc_read) | ||
1058 | create_proc_read_entry("nsd", 0, | ||
1059 | wlandev->procdir, | ||
1060 | wlandev->nsd_proc_read, | ||
1061 | wlandev); | ||
1062 | } | ||
1063 | #endif | ||
1064 | |||
1065 | #ifdef CONFIG_HOTPLUG | ||
1066 | p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_REGISTER); | ||
1067 | #endif | ||
1068 | |||
1069 | DBFEXIT; | ||
1070 | return 0; | ||
1071 | } | ||
1072 | |||
1073 | |||
1074 | /*---------------------------------------------------------------- | ||
1075 | * unregister_wlandev | ||
1076 | * | ||
1077 | * Roughly matches the functionality of unregister_netdev. This | ||
1078 | * function is called to remove a named device from the system. | ||
1079 | * | ||
1080 | * First we tell linux that the device should no longer exist. | ||
1081 | * Then we remove it from the list of known wlan devices. | ||
1082 | * | ||
1083 | * Arguments: | ||
1084 | * wlandev ptr to the wlandev structure for the | ||
1085 | * interface. | ||
1086 | * Returns: | ||
1087 | * zero on success, non-zero otherwise. | ||
1088 | * Call Context: | ||
1089 | * Can be either interrupt or not. | ||
1090 | ----------------------------------------------------------------*/ | ||
1091 | int unregister_wlandev(wlandevice_t *wlandev) | ||
1092 | { | ||
1093 | struct sk_buff *skb; | ||
1094 | |||
1095 | DBFENTER; | ||
1096 | |||
1097 | #ifdef CONFIG_HOTPLUG | ||
1098 | p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_REMOVE); | ||
1099 | #endif | ||
1100 | |||
1101 | #ifdef CONFIG_PROC_FS | ||
1102 | if ( wlandev->procwlandev ) { | ||
1103 | remove_proc_entry("wlandev", wlandev->procdir); | ||
1104 | } | ||
1105 | if ( wlandev->nsd_proc_read ) { | ||
1106 | remove_proc_entry("nsd", wlandev->procdir); | ||
1107 | } | ||
1108 | if (wlandev->procdir) { | ||
1109 | remove_proc_entry(wlandev->name, proc_p80211); | ||
1110 | } | ||
1111 | #endif | ||
1112 | |||
1113 | unregister_netdev(wlandev->netdev); | ||
1114 | |||
1115 | /* Now to clean out the rx queue */ | ||
1116 | while ( (skb = skb_dequeue(&wlandev->nsd_rxq)) ) { | ||
1117 | dev_kfree_skb(skb); | ||
1118 | } | ||
1119 | |||
1120 | DBFEXIT; | ||
1121 | return 0; | ||
1122 | } | ||
1123 | |||
1124 | #ifdef CONFIG_PROC_FS | ||
1125 | /*---------------------------------------------------------------- | ||
1126 | * proc_read | ||
1127 | * | ||
1128 | * Read function for /proc/net/p80211/<device>/wlandev | ||
1129 | * | ||
1130 | * Arguments: | ||
1131 | * buf | ||
1132 | * start | ||
1133 | * offset | ||
1134 | * count | ||
1135 | * eof | ||
1136 | * data | ||
1137 | * Returns: | ||
1138 | * zero on success, non-zero otherwise. | ||
1139 | * Call Context: | ||
1140 | * Can be either interrupt or not. | ||
1141 | ----------------------------------------------------------------*/ | ||
1142 | static int | ||
1143 | p80211netdev_proc_read( | ||
1144 | char *page, | ||
1145 | char **start, | ||
1146 | off_t offset, | ||
1147 | int count, | ||
1148 | int *eof, | ||
1149 | void *data) | ||
1150 | { | ||
1151 | char *p = page; | ||
1152 | wlandevice_t *wlandev = (wlandevice_t *) data; | ||
1153 | |||
1154 | DBFENTER; | ||
1155 | if (offset != 0) { | ||
1156 | *eof = 1; | ||
1157 | goto exit; | ||
1158 | } | ||
1159 | |||
1160 | p += sprintf(p, "p80211 version: %s (%s)\n\n", | ||
1161 | WLAN_RELEASE, WLAN_BUILD_DATE); | ||
1162 | p += sprintf(p, "name : %s\n", wlandev->name); | ||
1163 | p += sprintf(p, "nsd name : %s\n", wlandev->nsdname); | ||
1164 | p += sprintf(p, "address : %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
1165 | wlandev->netdev->dev_addr[0], wlandev->netdev->dev_addr[1], wlandev->netdev->dev_addr[2], | ||
1166 | wlandev->netdev->dev_addr[3], wlandev->netdev->dev_addr[4], wlandev->netdev->dev_addr[5]); | ||
1167 | p += sprintf(p, "nsd caps : %s%s%s%s%s%s%s%s%s%s\n", | ||
1168 | (wlandev->nsdcaps & P80211_NSDCAP_HARDWAREWEP) ? "wep_hw " : "", | ||
1169 | (wlandev->nsdcaps & P80211_NSDCAP_TIEDWEP) ? "wep_tied " : "", | ||
1170 | (wlandev->nsdcaps & P80211_NSDCAP_NOHOSTWEP) ? "wep_hw_only " : "", | ||
1171 | (wlandev->nsdcaps & P80211_NSDCAP_PBCC) ? "pbcc " : "", | ||
1172 | (wlandev->nsdcaps & P80211_NSDCAP_SHORT_PREAMBLE) ? "short_preamble " : "", | ||
1173 | (wlandev->nsdcaps & P80211_NSDCAP_AGILITY) ? "agility " : "", | ||
1174 | (wlandev->nsdcaps & P80211_NSDCAP_AP_RETRANSMIT) ? "ap_retransmit " : "", | ||
1175 | (wlandev->nsdcaps & P80211_NSDCAP_HWFRAGMENT) ? "hw_frag " : "", | ||
1176 | (wlandev->nsdcaps & P80211_NSDCAP_AUTOJOIN) ? "autojoin " : "", | ||
1177 | (wlandev->nsdcaps & P80211_NSDCAP_NOSCAN) ? "" : "scan "); | ||
1178 | |||
1179 | |||
1180 | p += sprintf(p, "bssid : %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
1181 | wlandev->bssid[0], wlandev->bssid[1], wlandev->bssid[2], | ||
1182 | wlandev->bssid[3], wlandev->bssid[4], wlandev->bssid[5]); | ||
1183 | |||
1184 | p += sprintf(p, "Enabled : %s%s\n", | ||
1185 | (wlandev->shortpreamble) ? "short_preamble " : "", | ||
1186 | (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) ? "privacy" : ""); | ||
1187 | |||
1188 | |||
1189 | exit: | ||
1190 | DBFEXIT; | ||
1191 | return (p - page); | ||
1192 | } | ||
1193 | #endif | ||
1194 | |||
1195 | /*---------------------------------------------------------------- | ||
1196 | * p80211netdev_hwremoved | ||
1197 | * | ||
1198 | * Hardware removed notification. This function should be called | ||
1199 | * immediately after an MSD has detected that the underlying hardware | ||
1200 | * has been yanked out from under us. The primary things we need | ||
1201 | * to do are: | ||
1202 | * - Mark the wlandev | ||
1203 | * - Prevent any further traffic from the knetdev i/f | ||
1204 | * - Prevent any further requests from mgmt i/f | ||
1205 | * - If there are any waitq'd mgmt requests or mgmt-frame exchanges, | ||
1206 | * shut them down. | ||
1207 | * - Call the MSD hwremoved function. | ||
1208 | * | ||
1209 | * The remainder of the cleanup will be handled by unregister(). | ||
1210 | * Our primary goal here is to prevent as much tickling of the MSD | ||
1211 | * as possible since the MSD is already in a 'wounded' state. | ||
1212 | * | ||
1213 | * TODO: As new features are added, this function should be | ||
1214 | * updated. | ||
1215 | * | ||
1216 | * Arguments: | ||
1217 | * wlandev WLAN network device structure | ||
1218 | * Returns: | ||
1219 | * nothing | ||
1220 | * Side effects: | ||
1221 | * | ||
1222 | * Call context: | ||
1223 | * Usually interrupt. | ||
1224 | ----------------------------------------------------------------*/ | ||
1225 | void p80211netdev_hwremoved(wlandevice_t *wlandev) | ||
1226 | { | ||
1227 | DBFENTER; | ||
1228 | wlandev->hwremoved = 1; | ||
1229 | if ( wlandev->state == WLAN_DEVICE_OPEN) { | ||
1230 | p80211netdev_stop_queue(wlandev); | ||
1231 | } | ||
1232 | |||
1233 | netif_device_detach(wlandev->netdev); | ||
1234 | |||
1235 | DBFEXIT; | ||
1236 | } | ||
1237 | |||
1238 | |||
1239 | /*---------------------------------------------------------------- | ||
1240 | * p80211_rx_typedrop | ||
1241 | * | ||
1242 | * Classifies the frame, increments the appropriate counter, and | ||
1243 | * returns 0|1|2 indicating whether the driver should handle, ignore, or | ||
1244 | * drop the frame | ||
1245 | * | ||
1246 | * Arguments: | ||
1247 | * wlandev wlan device structure | ||
1248 | * fc frame control field | ||
1249 | * | ||
1250 | * Returns: | ||
1251 | * zero if the frame should be handled by the driver, | ||
1252 | * one if the frame should be ignored | ||
1253 | * anything else means we drop it. | ||
1254 | * | ||
1255 | * Side effects: | ||
1256 | * | ||
1257 | * Call context: | ||
1258 | * interrupt | ||
1259 | ----------------------------------------------------------------*/ | ||
1260 | static int p80211_rx_typedrop( wlandevice_t *wlandev, UINT16 fc) | ||
1261 | { | ||
1262 | UINT16 ftype; | ||
1263 | UINT16 fstype; | ||
1264 | int drop = 0; | ||
1265 | /* Classify frame, increment counter */ | ||
1266 | ftype = WLAN_GET_FC_FTYPE(fc); | ||
1267 | fstype = WLAN_GET_FC_FSTYPE(fc); | ||
1268 | #if 0 | ||
1269 | WLAN_LOG_DEBUG(4, | ||
1270 | "rx_typedrop : ftype=%d fstype=%d.\n", ftype, fstype); | ||
1271 | #endif | ||
1272 | switch ( ftype ) { | ||
1273 | case WLAN_FTYPE_MGMT: | ||
1274 | if ((wlandev->netdev->flags & IFF_PROMISC) || | ||
1275 | (wlandev->netdev->flags & IFF_ALLMULTI)) { | ||
1276 | drop = 1; | ||
1277 | break; | ||
1278 | } | ||
1279 | WLAN_LOG_DEBUG(3, "rx'd mgmt:\n"); | ||
1280 | wlandev->rx.mgmt++; | ||
1281 | switch( fstype ) { | ||
1282 | case WLAN_FSTYPE_ASSOCREQ: | ||
1283 | /* printk("assocreq"); */ | ||
1284 | wlandev->rx.assocreq++; | ||
1285 | break; | ||
1286 | case WLAN_FSTYPE_ASSOCRESP: | ||
1287 | /* printk("assocresp"); */ | ||
1288 | wlandev->rx.assocresp++; | ||
1289 | break; | ||
1290 | case WLAN_FSTYPE_REASSOCREQ: | ||
1291 | /* printk("reassocreq"); */ | ||
1292 | wlandev->rx.reassocreq++; | ||
1293 | break; | ||
1294 | case WLAN_FSTYPE_REASSOCRESP: | ||
1295 | /* printk("reassocresp"); */ | ||
1296 | wlandev->rx.reassocresp++; | ||
1297 | break; | ||
1298 | case WLAN_FSTYPE_PROBEREQ: | ||
1299 | /* printk("probereq"); */ | ||
1300 | wlandev->rx.probereq++; | ||
1301 | break; | ||
1302 | case WLAN_FSTYPE_PROBERESP: | ||
1303 | /* printk("proberesp"); */ | ||
1304 | wlandev->rx.proberesp++; | ||
1305 | break; | ||
1306 | case WLAN_FSTYPE_BEACON: | ||
1307 | /* printk("beacon"); */ | ||
1308 | wlandev->rx.beacon++; | ||
1309 | break; | ||
1310 | case WLAN_FSTYPE_ATIM: | ||
1311 | /* printk("atim"); */ | ||
1312 | wlandev->rx.atim++; | ||
1313 | break; | ||
1314 | case WLAN_FSTYPE_DISASSOC: | ||
1315 | /* printk("disassoc"); */ | ||
1316 | wlandev->rx.disassoc++; | ||
1317 | break; | ||
1318 | case WLAN_FSTYPE_AUTHEN: | ||
1319 | /* printk("authen"); */ | ||
1320 | wlandev->rx.authen++; | ||
1321 | break; | ||
1322 | case WLAN_FSTYPE_DEAUTHEN: | ||
1323 | /* printk("deauthen"); */ | ||
1324 | wlandev->rx.deauthen++; | ||
1325 | break; | ||
1326 | default: | ||
1327 | /* printk("unknown"); */ | ||
1328 | wlandev->rx.mgmt_unknown++; | ||
1329 | break; | ||
1330 | } | ||
1331 | /* printk("\n"); */ | ||
1332 | drop = 2; | ||
1333 | break; | ||
1334 | |||
1335 | case WLAN_FTYPE_CTL: | ||
1336 | if ((wlandev->netdev->flags & IFF_PROMISC) || | ||
1337 | (wlandev->netdev->flags & IFF_ALLMULTI)) { | ||
1338 | drop = 1; | ||
1339 | break; | ||
1340 | } | ||
1341 | WLAN_LOG_DEBUG(3, "rx'd ctl:\n"); | ||
1342 | wlandev->rx.ctl++; | ||
1343 | switch( fstype ) { | ||
1344 | case WLAN_FSTYPE_PSPOLL: | ||
1345 | /* printk("pspoll"); */ | ||
1346 | wlandev->rx.pspoll++; | ||
1347 | break; | ||
1348 | case WLAN_FSTYPE_RTS: | ||
1349 | /* printk("rts"); */ | ||
1350 | wlandev->rx.rts++; | ||
1351 | break; | ||
1352 | case WLAN_FSTYPE_CTS: | ||
1353 | /* printk("cts"); */ | ||
1354 | wlandev->rx.cts++; | ||
1355 | break; | ||
1356 | case WLAN_FSTYPE_ACK: | ||
1357 | /* printk("ack"); */ | ||
1358 | wlandev->rx.ack++; | ||
1359 | break; | ||
1360 | case WLAN_FSTYPE_CFEND: | ||
1361 | /* printk("cfend"); */ | ||
1362 | wlandev->rx.cfend++; | ||
1363 | break; | ||
1364 | case WLAN_FSTYPE_CFENDCFACK: | ||
1365 | /* printk("cfendcfack"); */ | ||
1366 | wlandev->rx.cfendcfack++; | ||
1367 | break; | ||
1368 | default: | ||
1369 | /* printk("unknown"); */ | ||
1370 | wlandev->rx.ctl_unknown++; | ||
1371 | break; | ||
1372 | } | ||
1373 | /* printk("\n"); */ | ||
1374 | drop = 2; | ||
1375 | break; | ||
1376 | |||
1377 | case WLAN_FTYPE_DATA: | ||
1378 | wlandev->rx.data++; | ||
1379 | switch( fstype ) { | ||
1380 | case WLAN_FSTYPE_DATAONLY: | ||
1381 | wlandev->rx.dataonly++; | ||
1382 | break; | ||
1383 | case WLAN_FSTYPE_DATA_CFACK: | ||
1384 | wlandev->rx.data_cfack++; | ||
1385 | break; | ||
1386 | case WLAN_FSTYPE_DATA_CFPOLL: | ||
1387 | wlandev->rx.data_cfpoll++; | ||
1388 | break; | ||
1389 | case WLAN_FSTYPE_DATA_CFACK_CFPOLL: | ||
1390 | wlandev->rx.data__cfack_cfpoll++; | ||
1391 | break; | ||
1392 | case WLAN_FSTYPE_NULL: | ||
1393 | WLAN_LOG_DEBUG(3, "rx'd data:null\n"); | ||
1394 | wlandev->rx.null++; | ||
1395 | break; | ||
1396 | case WLAN_FSTYPE_CFACK: | ||
1397 | WLAN_LOG_DEBUG(3, "rx'd data:cfack\n"); | ||
1398 | wlandev->rx.cfack++; | ||
1399 | break; | ||
1400 | case WLAN_FSTYPE_CFPOLL: | ||
1401 | WLAN_LOG_DEBUG(3, "rx'd data:cfpoll\n"); | ||
1402 | wlandev->rx.cfpoll++; | ||
1403 | break; | ||
1404 | case WLAN_FSTYPE_CFACK_CFPOLL: | ||
1405 | WLAN_LOG_DEBUG(3, "rx'd data:cfack_cfpoll\n"); | ||
1406 | wlandev->rx.cfack_cfpoll++; | ||
1407 | break; | ||
1408 | default: | ||
1409 | /* printk("unknown"); */ | ||
1410 | wlandev->rx.data_unknown++; | ||
1411 | break; | ||
1412 | } | ||
1413 | |||
1414 | break; | ||
1415 | } | ||
1416 | return drop; | ||
1417 | } | ||
1418 | |||
1419 | #ifdef CONFIG_HOTPLUG | ||
1420 | /* Notify userspace when a netdevice event occurs, | ||
1421 | * by running '/sbin/hotplug net' with certain | ||
1422 | * environment variables set. | ||
1423 | */ | ||
1424 | int p80211_run_sbin_hotplug(wlandevice_t *wlandev, char *action) | ||
1425 | { | ||
1426 | char *argv[3], *envp[7], ifname[12 + IFNAMSIZ], action_str[32]; | ||
1427 | char nsdname[32], wlan_wext[32]; | ||
1428 | int i; | ||
1429 | |||
1430 | if (wlandev) { | ||
1431 | sprintf(ifname, "INTERFACE=%s", wlandev->name); | ||
1432 | sprintf(nsdname, "NSDNAME=%s", wlandev->nsdname); | ||
1433 | } else { | ||
1434 | sprintf(ifname, "INTERFACE=null"); | ||
1435 | sprintf(nsdname, "NSDNAME=null"); | ||
1436 | } | ||
1437 | |||
1438 | sprintf(wlan_wext, "WLAN_WEXT=%s", wlan_wext_write ? "y" : ""); | ||
1439 | sprintf(action_str, "ACTION=%s", action); | ||
1440 | |||
1441 | i = 0; | ||
1442 | argv[i++] = hotplug_path; | ||
1443 | argv[i++] = "wlan"; | ||
1444 | argv[i] = NULL; | ||
1445 | |||
1446 | i = 0; | ||
1447 | /* minimal command environment */ | ||
1448 | envp [i++] = "HOME=/"; | ||
1449 | envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; | ||
1450 | envp [i++] = ifname; | ||
1451 | envp [i++] = action_str; | ||
1452 | envp [i++] = nsdname; | ||
1453 | envp [i++] = wlan_wext; | ||
1454 | envp [i] = NULL; | ||
1455 | |||
1456 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,62)) | ||
1457 | return call_usermodehelper(argv [0], argv, envp); | ||
1458 | #else | ||
1459 | return call_usermodehelper(argv [0], argv, envp, 0); | ||
1460 | #endif | ||
1461 | } | ||
1462 | |||
1463 | #endif | ||
1464 | |||
1465 | |||
1466 | void p80211_suspend(wlandevice_t *wlandev) | ||
1467 | { | ||
1468 | DBFENTER; | ||
1469 | |||
1470 | #ifdef CONFIG_HOTPLUG | ||
1471 | p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_SUSPEND); | ||
1472 | #endif | ||
1473 | |||
1474 | DBFEXIT; | ||
1475 | } | ||
1476 | |||
1477 | void p80211_resume(wlandevice_t *wlandev) | ||
1478 | { | ||
1479 | DBFENTER; | ||
1480 | |||
1481 | #ifdef CONFIG_HOTPLUG | ||
1482 | p80211_run_sbin_hotplug(wlandev, WLAN_HOTPLUG_RESUME); | ||
1483 | #endif | ||
1484 | |||
1485 | DBFEXIT; | ||
1486 | } | ||
1487 | |||
1488 | static void p80211knetdev_tx_timeout( netdevice_t *netdev) | ||
1489 | { | ||
1490 | wlandevice_t *wlandev = (wlandevice_t*)netdev->priv; | ||
1491 | DBFENTER; | ||
1492 | |||
1493 | if (wlandev->tx_timeout) { | ||
1494 | wlandev->tx_timeout(wlandev); | ||
1495 | } else { | ||
1496 | WLAN_LOG_WARNING("Implement tx_timeout for %s\n", | ||
1497 | wlandev->nsdname); | ||
1498 | p80211netdev_wake_queue(wlandev); | ||
1499 | } | ||
1500 | |||
1501 | DBFEXIT; | ||
1502 | } | ||
diff --git a/drivers/staging/wlan-ng/p80211netdev.h b/drivers/staging/wlan-ng/p80211netdev.h new file mode 100644 index 000000000000..9b2e0cdcb449 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211netdev.h | |||
@@ -0,0 +1,336 @@ | |||
1 | /* p80211netdev.h | ||
2 | * | ||
3 | * WLAN net device structure and functions | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares the structure type that represents each wlan | ||
48 | * interface. | ||
49 | * | ||
50 | * -------------------------------------------------------------------- | ||
51 | */ | ||
52 | |||
53 | #ifndef _LINUX_P80211NETDEV_H | ||
54 | #define _LINUX_P80211NETDEV_H | ||
55 | |||
56 | #include <linux/interrupt.h> | ||
57 | #include <linux/wireless.h> | ||
58 | |||
59 | /*================================================================*/ | ||
60 | /* Constants */ | ||
61 | |||
62 | #define WLAN_DEVICE_CLOSED 0 | ||
63 | #define WLAN_DEVICE_OPEN 1 | ||
64 | |||
65 | #define WLAN_MACMODE_NONE 0 | ||
66 | #define WLAN_MACMODE_IBSS_STA 1 | ||
67 | #define WLAN_MACMODE_ESS_STA 2 | ||
68 | #define WLAN_MACMODE_ESS_AP 3 | ||
69 | |||
70 | /* MSD States */ | ||
71 | #define WLAN_MSD_START -1 | ||
72 | #define WLAN_MSD_DRIVERLOADED 0 | ||
73 | #define WLAN_MSD_HWPRESENT_PENDING 1 | ||
74 | #define WLAN_MSD_HWFAIL 2 | ||
75 | #define WLAN_MSD_HWPRESENT 3 | ||
76 | #define WLAN_MSD_FWLOAD_PENDING 4 | ||
77 | #define WLAN_MSD_FWLOAD 5 | ||
78 | #define WLAN_MSD_RUNNING_PENDING 6 | ||
79 | #define WLAN_MSD_RUNNING 7 | ||
80 | |||
81 | #ifndef ETH_P_ECONET | ||
82 | #define ETH_P_ECONET 0x0018 /* needed for 2.2.x kernels */ | ||
83 | #endif | ||
84 | |||
85 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) | ||
86 | |||
87 | #ifndef ARPHRD_IEEE80211 | ||
88 | #define ARPHRD_IEEE80211 801 /* kernel 2.4.6 */ | ||
89 | #endif | ||
90 | |||
91 | #ifndef ARPHRD_IEEE80211_PRISM /* kernel 2.4.18 */ | ||
92 | #define ARPHRD_IEEE80211_PRISM 802 | ||
93 | #endif | ||
94 | |||
95 | /*--- NSD Capabilities Flags ------------------------------*/ | ||
96 | #define P80211_NSDCAP_HARDWAREWEP 0x01 /* hardware wep engine */ | ||
97 | #define P80211_NSDCAP_TIEDWEP 0x02 /* can't decouple en/de */ | ||
98 | #define P80211_NSDCAP_NOHOSTWEP 0x04 /* must use hardware wep */ | ||
99 | #define P80211_NSDCAP_PBCC 0x08 /* hardware supports PBCC */ | ||
100 | #define P80211_NSDCAP_SHORT_PREAMBLE 0x10 /* hardware supports */ | ||
101 | #define P80211_NSDCAP_AGILITY 0x20 /* hardware supports */ | ||
102 | #define P80211_NSDCAP_AP_RETRANSMIT 0x40 /* nsd handles retransmits */ | ||
103 | #define P80211_NSDCAP_HWFRAGMENT 0x80 /* nsd handles frag/defrag */ | ||
104 | #define P80211_NSDCAP_AUTOJOIN 0x100 /* nsd does autojoin */ | ||
105 | #define P80211_NSDCAP_NOSCAN 0x200 /* nsd can scan */ | ||
106 | |||
107 | /*================================================================*/ | ||
108 | /* Macros */ | ||
109 | |||
110 | /*================================================================*/ | ||
111 | /* Types */ | ||
112 | |||
113 | /* Received frame statistics */ | ||
114 | typedef struct p80211_frmrx_t | ||
115 | { | ||
116 | UINT32 mgmt; | ||
117 | UINT32 assocreq; | ||
118 | UINT32 assocresp; | ||
119 | UINT32 reassocreq; | ||
120 | UINT32 reassocresp; | ||
121 | UINT32 probereq; | ||
122 | UINT32 proberesp; | ||
123 | UINT32 beacon; | ||
124 | UINT32 atim; | ||
125 | UINT32 disassoc; | ||
126 | UINT32 authen; | ||
127 | UINT32 deauthen; | ||
128 | UINT32 mgmt_unknown; | ||
129 | UINT32 ctl; | ||
130 | UINT32 pspoll; | ||
131 | UINT32 rts; | ||
132 | UINT32 cts; | ||
133 | UINT32 ack; | ||
134 | UINT32 cfend; | ||
135 | UINT32 cfendcfack; | ||
136 | UINT32 ctl_unknown; | ||
137 | UINT32 data; | ||
138 | UINT32 dataonly; | ||
139 | UINT32 data_cfack; | ||
140 | UINT32 data_cfpoll; | ||
141 | UINT32 data__cfack_cfpoll; | ||
142 | UINT32 null; | ||
143 | UINT32 cfack; | ||
144 | UINT32 cfpoll; | ||
145 | UINT32 cfack_cfpoll; | ||
146 | UINT32 data_unknown; | ||
147 | UINT32 decrypt; | ||
148 | UINT32 decrypt_err; | ||
149 | } p80211_frmrx_t; | ||
150 | |||
151 | #ifdef WIRELESS_EXT | ||
152 | /* called by /proc/net/wireless */ | ||
153 | struct iw_statistics* p80211wext_get_wireless_stats(netdevice_t *dev); | ||
154 | /* wireless extensions' ioctls */ | ||
155 | int p80211wext_support_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd); | ||
156 | #if WIRELESS_EXT > 12 | ||
157 | extern struct iw_handler_def p80211wext_handler_def; | ||
158 | #endif | ||
159 | |||
160 | int p80211wext_event_associated(struct wlandevice *wlandev, int assoc); | ||
161 | |||
162 | #endif /* wireless extensions */ | ||
163 | |||
164 | /* WEP stuff */ | ||
165 | #define NUM_WEPKEYS 4 | ||
166 | #define MAX_KEYLEN 32 | ||
167 | |||
168 | #define HOSTWEP_DEFAULTKEY_MASK (BIT1|BIT0) | ||
169 | #define HOSTWEP_DECRYPT BIT4 | ||
170 | #define HOSTWEP_ENCRYPT BIT5 | ||
171 | #define HOSTWEP_PRIVACYINVOKED BIT6 | ||
172 | #define HOSTWEP_EXCLUDEUNENCRYPTED BIT7 | ||
173 | |||
174 | extern int wlan_watchdog; | ||
175 | extern int wlan_wext_write; | ||
176 | |||
177 | /* WLAN device type */ | ||
178 | typedef struct wlandevice | ||
179 | { | ||
180 | struct wlandevice *next; /* link for list of devices */ | ||
181 | void *priv; /* private data for MSD */ | ||
182 | |||
183 | /* Subsystem State */ | ||
184 | char name[WLAN_DEVNAMELEN_MAX]; /* Dev name, from register_wlandev()*/ | ||
185 | char *nsdname; | ||
186 | |||
187 | UINT32 state; /* Device I/F state (open/closed) */ | ||
188 | UINT32 msdstate; /* state of underlying driver */ | ||
189 | UINT32 hwremoved; /* Has the hw been yanked out? */ | ||
190 | |||
191 | /* Hardware config */ | ||
192 | UINT irq; | ||
193 | UINT iobase; | ||
194 | UINT membase; | ||
195 | UINT32 nsdcaps; /* NSD Capabilities flags */ | ||
196 | |||
197 | /* Config vars */ | ||
198 | UINT ethconv; | ||
199 | |||
200 | /* device methods (init by MSD, used by p80211 */ | ||
201 | int (*open)(struct wlandevice *wlandev); | ||
202 | int (*close)(struct wlandevice *wlandev); | ||
203 | void (*reset)(struct wlandevice *wlandev ); | ||
204 | int (*txframe)(struct wlandevice *wlandev, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep); | ||
205 | int (*mlmerequest)(struct wlandevice *wlandev, p80211msg_t *msg); | ||
206 | int (*set_multicast_list)(struct wlandevice *wlandev, | ||
207 | netdevice_t *dev); | ||
208 | void (*tx_timeout)(struct wlandevice *wlandev); | ||
209 | |||
210 | #ifdef CONFIG_PROC_FS | ||
211 | int (*nsd_proc_read)(char *page, char **start, off_t offset, int count, int *eof, void *data); | ||
212 | #endif | ||
213 | |||
214 | /* 802.11 State */ | ||
215 | UINT8 bssid[WLAN_BSSID_LEN]; | ||
216 | p80211pstr32_t ssid; | ||
217 | UINT32 macmode; | ||
218 | int linkstatus; | ||
219 | int shortpreamble; /* C bool */ | ||
220 | |||
221 | /* WEP State */ | ||
222 | UINT8 wep_keys[NUM_WEPKEYS][MAX_KEYLEN]; | ||
223 | UINT8 wep_keylens[NUM_WEPKEYS]; | ||
224 | int hostwep; | ||
225 | |||
226 | /* Request/Confirm i/f state (used by p80211) */ | ||
227 | unsigned long request_pending; /* flag, access atomically */ | ||
228 | |||
229 | /* netlink socket */ | ||
230 | /* queue for indications waiting for cmd completion */ | ||
231 | /* Linux netdevice and support */ | ||
232 | netdevice_t *netdev; /* ptr to linux netdevice */ | ||
233 | struct net_device_stats linux_stats; | ||
234 | |||
235 | #ifdef CONFIG_PROC_FS | ||
236 | /* Procfs support */ | ||
237 | struct proc_dir_entry *procdir; | ||
238 | struct proc_dir_entry *procwlandev; | ||
239 | #endif | ||
240 | |||
241 | /* Rx bottom half */ | ||
242 | struct tasklet_struct rx_bh; | ||
243 | |||
244 | struct sk_buff_head nsd_rxq; | ||
245 | |||
246 | /* 802.11 device statistics */ | ||
247 | struct p80211_frmrx_t rx; | ||
248 | |||
249 | /* compatibility to wireless extensions */ | ||
250 | #ifdef WIRELESS_EXT | ||
251 | struct iw_statistics wstats; | ||
252 | |||
253 | /* jkriegl: iwspy fields */ | ||
254 | UINT8 spy_number; | ||
255 | char spy_address[IW_MAX_SPY][ETH_ALEN]; | ||
256 | struct iw_quality spy_stat[IW_MAX_SPY]; | ||
257 | |||
258 | #endif | ||
259 | |||
260 | } wlandevice_t; | ||
261 | |||
262 | /* WEP stuff */ | ||
263 | int wep_change_key(wlandevice_t *wlandev, int keynum, UINT8* key, int keylen); | ||
264 | int wep_decrypt(wlandevice_t *wlandev, UINT8 *buf, UINT32 len, int key_override, UINT8 *iv, UINT8 *icv); | ||
265 | int wep_encrypt(wlandevice_t *wlandev, UINT8 *buf, UINT8 *dst, UINT32 len, int keynum, UINT8 *iv, UINT8 *icv); | ||
266 | |||
267 | /*================================================================*/ | ||
268 | /* Externs */ | ||
269 | |||
270 | /*================================================================*/ | ||
271 | /* Function Declarations */ | ||
272 | |||
273 | void p80211netdev_startup(void); | ||
274 | void p80211netdev_shutdown(void); | ||
275 | int wlan_setup(wlandevice_t *wlandev); | ||
276 | int wlan_unsetup(wlandevice_t *wlandev); | ||
277 | int register_wlandev(wlandevice_t *wlandev); | ||
278 | int unregister_wlandev(wlandevice_t *wlandev); | ||
279 | void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb); | ||
280 | void p80211netdev_hwremoved(wlandevice_t *wlandev); | ||
281 | void p80211_suspend(wlandevice_t *wlandev); | ||
282 | void p80211_resume(wlandevice_t *wlandev); | ||
283 | |||
284 | /*================================================================*/ | ||
285 | /* Function Definitions */ | ||
286 | |||
287 | static inline void | ||
288 | p80211netdev_stop_queue(wlandevice_t *wlandev) | ||
289 | { | ||
290 | if ( !wlandev ) return; | ||
291 | if ( !wlandev->netdev ) return; | ||
292 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) ) | ||
293 | wlandev->netdev->tbusy = 1; | ||
294 | wlandev->netdev->start = 0; | ||
295 | #else | ||
296 | netif_stop_queue(wlandev->netdev); | ||
297 | #endif | ||
298 | } | ||
299 | |||
300 | static inline void | ||
301 | p80211netdev_start_queue(wlandevice_t *wlandev) | ||
302 | { | ||
303 | if ( !wlandev ) return; | ||
304 | if ( !wlandev->netdev ) return; | ||
305 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) ) | ||
306 | wlandev->netdev->tbusy = 0; | ||
307 | wlandev->netdev->start = 1; | ||
308 | #else | ||
309 | netif_start_queue(wlandev->netdev); | ||
310 | #endif | ||
311 | } | ||
312 | |||
313 | static inline void | ||
314 | p80211netdev_wake_queue(wlandevice_t *wlandev) | ||
315 | { | ||
316 | if ( !wlandev ) return; | ||
317 | if ( !wlandev->netdev ) return; | ||
318 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) ) | ||
319 | wlandev->netdev->tbusy = 0; | ||
320 | mark_bh(NET_BH); | ||
321 | #else | ||
322 | netif_wake_queue(wlandev->netdev); | ||
323 | #endif | ||
324 | } | ||
325 | |||
326 | #ifdef CONFIG_HOTPLUG | ||
327 | #define WLAN_HOTPLUG_REGISTER "register" | ||
328 | #define WLAN_HOTPLUG_REMOVE "remove" | ||
329 | #define WLAN_HOTPLUG_STARTUP "startup" | ||
330 | #define WLAN_HOTPLUG_SHUTDOWN "shutdown" | ||
331 | #define WLAN_HOTPLUG_SUSPEND "suspend" | ||
332 | #define WLAN_HOTPLUG_RESUME "resume" | ||
333 | int p80211_run_sbin_hotplug(wlandevice_t *wlandev, char *action); | ||
334 | #endif | ||
335 | |||
336 | #endif | ||
diff --git a/drivers/staging/wlan-ng/p80211req.c b/drivers/staging/wlan-ng/p80211req.c new file mode 100644 index 000000000000..0233abeccc4b --- /dev/null +++ b/drivers/staging/wlan-ng/p80211req.c | |||
@@ -0,0 +1,329 @@ | |||
1 | /* src/p80211/p80211req.c | ||
2 | * | ||
3 | * Request/Indication/MacMgmt interface handling functions | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file contains the functions, types, and macros to support the | ||
48 | * MLME request interface that's implemented via the device ioctls. | ||
49 | * | ||
50 | * -------------------------------------------------------------------- | ||
51 | */ | ||
52 | |||
53 | /*================================================================*/ | ||
54 | /* System Includes */ | ||
55 | |||
56 | |||
57 | #include <linux/version.h> | ||
58 | |||
59 | #include <linux/module.h> | ||
60 | #include <linux/kernel.h> | ||
61 | #include <linux/sched.h> | ||
62 | #include <linux/types.h> | ||
63 | #include <linux/skbuff.h> | ||
64 | #include <linux/slab.h> | ||
65 | #include <linux/wireless.h> | ||
66 | #include <linux/netdevice.h> | ||
67 | #include <linux/etherdevice.h> | ||
68 | #include <net/sock.h> | ||
69 | #include <linux/netlink.h> | ||
70 | |||
71 | #include "version.h" | ||
72 | #include "wlan_compat.h" | ||
73 | |||
74 | /*================================================================*/ | ||
75 | /* Project Includes */ | ||
76 | |||
77 | #include "p80211types.h" | ||
78 | #include "p80211hdr.h" | ||
79 | #include "p80211mgmt.h" | ||
80 | #include "p80211conv.h" | ||
81 | #include "p80211msg.h" | ||
82 | #include "p80211netdev.h" | ||
83 | #include "p80211ioctl.h" | ||
84 | #include "p80211metadef.h" | ||
85 | #include "p80211metastruct.h" | ||
86 | #include "p80211req.h" | ||
87 | |||
88 | /*================================================================*/ | ||
89 | /* Local Constants */ | ||
90 | |||
91 | /* Maximum amount of time we'll wait for a request to complete */ | ||
92 | #define P80211REQ_MAXTIME 3*HZ /* 3 seconds */ | ||
93 | |||
94 | /*================================================================*/ | ||
95 | /* Local Macros */ | ||
96 | |||
97 | /*================================================================*/ | ||
98 | /* Local Types */ | ||
99 | |||
100 | /*================================================================*/ | ||
101 | /* Local Static Definitions */ | ||
102 | |||
103 | /*================================================================*/ | ||
104 | /* Local Function Declarations */ | ||
105 | |||
106 | static void p80211req_handlemsg( wlandevice_t *wlandev, p80211msg_t *msg); | ||
107 | static int p80211req_mibset_mibget(wlandevice_t *wlandev, p80211msg_dot11req_mibget_t *mib_msg, int isget); | ||
108 | |||
109 | /*================================================================*/ | ||
110 | /* Function Definitions */ | ||
111 | |||
112 | |||
113 | /*---------------------------------------------------------------- | ||
114 | * p80211req_dorequest | ||
115 | * | ||
116 | * Handles an MLME reqest/confirm message. | ||
117 | * | ||
118 | * Arguments: | ||
119 | * wlandev WLAN device struct | ||
120 | * msgbuf Buffer containing a request message | ||
121 | * | ||
122 | * Returns: | ||
123 | * 0 on success, an errno otherwise | ||
124 | * | ||
125 | * Call context: | ||
126 | * Potentially blocks the caller, so it's a good idea to | ||
127 | * not call this function from an interrupt context. | ||
128 | ----------------------------------------------------------------*/ | ||
129 | int p80211req_dorequest( wlandevice_t *wlandev, UINT8 *msgbuf) | ||
130 | { | ||
131 | int result = 0; | ||
132 | p80211msg_t *msg = (p80211msg_t*)msgbuf; | ||
133 | |||
134 | DBFENTER; | ||
135 | |||
136 | /* Check to make sure the MSD is running */ | ||
137 | if ( | ||
138 | !((wlandev->msdstate == WLAN_MSD_HWPRESENT && | ||
139 | msg->msgcode == DIDmsg_lnxreq_ifstate) || | ||
140 | wlandev->msdstate == WLAN_MSD_RUNNING || | ||
141 | wlandev->msdstate == WLAN_MSD_FWLOAD) ) { | ||
142 | return -ENODEV; | ||
143 | } | ||
144 | |||
145 | /* Check Permissions */ | ||
146 | if (!capable(CAP_NET_ADMIN) && | ||
147 | (msg->msgcode != DIDmsg_dot11req_mibget)) { | ||
148 | WLAN_LOG_ERROR("%s: only dot11req_mibget allowed for non-root.\n", wlandev->name); | ||
149 | return -EPERM; | ||
150 | } | ||
151 | |||
152 | /* Check for busy status */ | ||
153 | if ( test_and_set_bit(1, &(wlandev->request_pending))) { | ||
154 | return -EBUSY; | ||
155 | } | ||
156 | |||
157 | /* Allow p80211 to look at msg and handle if desired. */ | ||
158 | /* So far, all p80211 msgs are immediate, no waitq/timer necessary */ | ||
159 | /* This may change. */ | ||
160 | p80211req_handlemsg(wlandev, msg); | ||
161 | |||
162 | /* Pass it down to wlandev via wlandev->mlmerequest */ | ||
163 | if ( wlandev->mlmerequest != NULL ) | ||
164 | wlandev->mlmerequest(wlandev, msg); | ||
165 | |||
166 | clear_bit( 1, &(wlandev->request_pending)); | ||
167 | DBFEXIT; | ||
168 | return result; /* if result==0, msg->status still may contain an err */ | ||
169 | } | ||
170 | |||
171 | /*---------------------------------------------------------------- | ||
172 | * p80211req_handlemsg | ||
173 | * | ||
174 | * p80211 message handler. Primarily looks for messages that | ||
175 | * belong to p80211 and then dispatches the appropriate response. | ||
176 | * TODO: we don't do anything yet. Once the linuxMIB is better | ||
177 | * defined we'll need a get/set handler. | ||
178 | * | ||
179 | * Arguments: | ||
180 | * wlandev WLAN device struct | ||
181 | * msg message structure | ||
182 | * | ||
183 | * Returns: | ||
184 | * nothing (any results are set in the status field of the msg) | ||
185 | * | ||
186 | * Call context: | ||
187 | * Process thread | ||
188 | ----------------------------------------------------------------*/ | ||
189 | static void p80211req_handlemsg( wlandevice_t *wlandev, p80211msg_t *msg) | ||
190 | { | ||
191 | DBFENTER; | ||
192 | |||
193 | switch (msg->msgcode) { | ||
194 | |||
195 | case DIDmsg_lnxreq_hostwep: { | ||
196 | p80211msg_lnxreq_hostwep_t *req = (p80211msg_lnxreq_hostwep_t*) msg; | ||
197 | wlandev->hostwep &= ~(HOSTWEP_DECRYPT|HOSTWEP_ENCRYPT); | ||
198 | if (req->decrypt.data == P80211ENUM_truth_true) | ||
199 | wlandev->hostwep |= HOSTWEP_DECRYPT; | ||
200 | if (req->encrypt.data == P80211ENUM_truth_true) | ||
201 | wlandev->hostwep |= HOSTWEP_ENCRYPT; | ||
202 | |||
203 | break; | ||
204 | } | ||
205 | case DIDmsg_dot11req_mibget: | ||
206 | case DIDmsg_dot11req_mibset: { | ||
207 | int isget = (msg->msgcode == DIDmsg_dot11req_mibget); | ||
208 | p80211msg_dot11req_mibget_t *mib_msg = (p80211msg_dot11req_mibget_t *) msg; | ||
209 | p80211req_mibset_mibget (wlandev, mib_msg, isget); | ||
210 | } | ||
211 | default: | ||
212 | // XXX do nothing! | ||
213 | ; | ||
214 | } /* switch msg->msgcode */ | ||
215 | |||
216 | DBFEXIT; | ||
217 | |||
218 | return; | ||
219 | } | ||
220 | |||
221 | static int p80211req_mibset_mibget(wlandevice_t *wlandev, | ||
222 | p80211msg_dot11req_mibget_t *mib_msg, | ||
223 | int isget) | ||
224 | { | ||
225 | p80211itemd_t *mibitem = (p80211itemd_t *) mib_msg->mibattribute.data; | ||
226 | p80211pstrd_t *pstr = (p80211pstrd_t*) mibitem->data; | ||
227 | UINT8 *key = mibitem->data + sizeof(p80211pstrd_t); | ||
228 | |||
229 | DBFENTER; | ||
230 | |||
231 | switch (mibitem->did) { | ||
232 | case DIDmib_dot11smt_p80211Table_p80211_ifstate: { | ||
233 | UINT32 *data = (UINT32 *) mibitem->data; | ||
234 | if (isget) | ||
235 | switch (wlandev->msdstate) { | ||
236 | case WLAN_MSD_HWPRESENT: | ||
237 | *data = P80211ENUM_ifstate_disable; | ||
238 | break; | ||
239 | case WLAN_MSD_FWLOAD: | ||
240 | *data = P80211ENUM_ifstate_fwload; | ||
241 | break; | ||
242 | case WLAN_MSD_RUNNING: | ||
243 | *data = P80211ENUM_ifstate_enable; | ||
244 | break; | ||
245 | default: | ||
246 | *data = P80211ENUM_ifstate_enable; | ||
247 | } | ||
248 | break; | ||
249 | } | ||
250 | case DIDmib_dot11phy_dot11PhyOperationTable_dot11ShortPreambleEnabled: { | ||
251 | UINT32 *data = (UINT32 *) mibitem->data; | ||
252 | |||
253 | if (isget) | ||
254 | *data = wlandev->shortpreamble; | ||
255 | else | ||
256 | wlandev->shortpreamble = *data; | ||
257 | break; | ||
258 | } | ||
259 | case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0: { | ||
260 | if (!isget) | ||
261 | wep_change_key(wlandev, 0, key, pstr->len); | ||
262 | break; | ||
263 | } | ||
264 | case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1: { | ||
265 | if (!isget) | ||
266 | wep_change_key(wlandev, 1, key, pstr->len); | ||
267 | break; | ||
268 | } | ||
269 | case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2: { | ||
270 | if (!isget) | ||
271 | wep_change_key(wlandev, 2, key, pstr->len); | ||
272 | break; | ||
273 | } | ||
274 | case DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3: { | ||
275 | if (!isget) | ||
276 | wep_change_key(wlandev, 3, key, pstr->len); | ||
277 | break; | ||
278 | } | ||
279 | case DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID: { | ||
280 | UINT32 *data = (UINT32 *) mibitem->data; | ||
281 | |||
282 | if (isget) { | ||
283 | *data = wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK; | ||
284 | } else { | ||
285 | wlandev->hostwep &= ~(HOSTWEP_DEFAULTKEY_MASK); | ||
286 | |||
287 | wlandev->hostwep |= (*data & HOSTWEP_DEFAULTKEY_MASK); | ||
288 | } | ||
289 | break; | ||
290 | } | ||
291 | case DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked: { | ||
292 | UINT32 *data = (UINT32 *) mibitem->data; | ||
293 | |||
294 | if (isget) { | ||
295 | if (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) | ||
296 | *data = P80211ENUM_truth_true; | ||
297 | else | ||
298 | *data = P80211ENUM_truth_false; | ||
299 | } else { | ||
300 | wlandev->hostwep &= ~(HOSTWEP_PRIVACYINVOKED); | ||
301 | if (*data == P80211ENUM_truth_true) | ||
302 | wlandev->hostwep |= HOSTWEP_PRIVACYINVOKED; | ||
303 | } | ||
304 | break; | ||
305 | } | ||
306 | case DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted: { | ||
307 | UINT32 *data = (UINT32 *) mibitem->data; | ||
308 | |||
309 | if (isget) { | ||
310 | if (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) | ||
311 | *data = P80211ENUM_truth_true; | ||
312 | else | ||
313 | *data = P80211ENUM_truth_false; | ||
314 | } else { | ||
315 | wlandev->hostwep &= ~(HOSTWEP_EXCLUDEUNENCRYPTED); | ||
316 | if (*data == P80211ENUM_truth_true) | ||
317 | wlandev->hostwep |= HOSTWEP_EXCLUDEUNENCRYPTED; | ||
318 | } | ||
319 | break; | ||
320 | } | ||
321 | default: | ||
322 | // XXXX do nothing! | ||
323 | ; | ||
324 | } | ||
325 | |||
326 | DBFEXIT; | ||
327 | return 0; | ||
328 | } | ||
329 | |||
diff --git a/drivers/staging/wlan-ng/p80211req.h b/drivers/staging/wlan-ng/p80211req.h new file mode 100644 index 000000000000..54abdceedc5d --- /dev/null +++ b/drivers/staging/wlan-ng/p80211req.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* p80211req.h | ||
2 | * | ||
3 | * Request handling functions | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | */ | ||
47 | |||
48 | #ifndef _LINUX_P80211REQ_H | ||
49 | #define _LINUX_P80211REQ_H | ||
50 | |||
51 | /*================================================================*/ | ||
52 | /* Constants */ | ||
53 | |||
54 | /*================================================================*/ | ||
55 | /* Macros */ | ||
56 | |||
57 | /*================================================================*/ | ||
58 | /* Types */ | ||
59 | |||
60 | /*================================================================*/ | ||
61 | /* Externs */ | ||
62 | |||
63 | /*================================================================*/ | ||
64 | /* Function Declarations */ | ||
65 | |||
66 | int p80211req_dorequest(wlandevice_t *wlandev, UINT8 *msgbuf); | ||
67 | |||
68 | #endif | ||
diff --git a/drivers/staging/wlan-ng/p80211types.h b/drivers/staging/wlan-ng/p80211types.h new file mode 100644 index 000000000000..811b0ce39bf6 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211types.h | |||
@@ -0,0 +1,675 @@ | |||
1 | /* p80211types.h | ||
2 | * | ||
3 | * Macros, constants, types, and funcs for p80211 data types | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file declares some of the constants and types used in various | ||
48 | * parts of the linux-wlan system. | ||
49 | * | ||
50 | * Notes: | ||
51 | * - Constant values are always in HOST byte order. | ||
52 | * | ||
53 | * All functions and statics declared here are implemented in p80211types.c | ||
54 | * -------------------------------------------------------------------- | ||
55 | */ | ||
56 | |||
57 | #ifndef _P80211TYPES_H | ||
58 | #define _P80211TYPES_H | ||
59 | |||
60 | /*================================================================*/ | ||
61 | /* System Includes */ | ||
62 | /*================================================================*/ | ||
63 | |||
64 | /*================================================================*/ | ||
65 | /* Project Includes */ | ||
66 | /*================================================================*/ | ||
67 | |||
68 | #ifndef _WLAN_COMPAT_H | ||
69 | #include "wlan_compat.h" | ||
70 | #endif | ||
71 | |||
72 | /*================================================================*/ | ||
73 | /* Constants */ | ||
74 | /*================================================================*/ | ||
75 | |||
76 | /*----------------------------------------------------------------*/ | ||
77 | /* p80211 data type codes used for MIB items and message */ | ||
78 | /* arguments. The various metadata structures provide additional */ | ||
79 | /* information about these types. */ | ||
80 | |||
81 | #define P80211_TYPE_OCTETSTR 1 /* pascal array of bytes */ | ||
82 | #define P80211_TYPE_DISPLAYSTR 2 /* pascal array of bytes containing ascii */ | ||
83 | #define P80211_TYPE_INT 4 /* UINT32 min and max limited by 32 bits */ | ||
84 | #define P80211_TYPE_ENUMINT 5 /* UINT32 holding a numeric | ||
85 | code that can be mapped | ||
86 | to a textual name */ | ||
87 | #define P80211_TYPE_UNKDATA 6 /* Data item containing an | ||
88 | unknown data type */ | ||
89 | #define P80211_TYPE_INTARRAY 7 /* Array of 32-bit integers. */ | ||
90 | #define P80211_TYPE_BITARRAY 8 /* Array of bits. */ | ||
91 | #define P80211_TYPE_MACARRAY 9 /* Array of MAC addresses. */ | ||
92 | |||
93 | /*----------------------------------------------------------------*/ | ||
94 | /* The following constants are indexes into the Mib Category List */ | ||
95 | /* and the Message Category List */ | ||
96 | |||
97 | /* Mib Category List */ | ||
98 | #define P80211_MIB_CAT_DOT11SMT 1 | ||
99 | #define P80211_MIB_CAT_DOT11MAC 2 | ||
100 | #define P80211_MIB_CAT_DOT11PHY 3 | ||
101 | |||
102 | #define P80211SEC_DOT11SMT P80211_MIB_CAT_DOT11SMT | ||
103 | #define P80211SEC_DOT11MAC P80211_MIB_CAT_DOT11MAC | ||
104 | #define P80211SEC_DOT11PHY P80211_MIB_CAT_DOT11PHY | ||
105 | |||
106 | /* Message Category List */ | ||
107 | #define P80211_MSG_CAT_DOT11REQ 1 | ||
108 | #define P80211_MSG_CAT_DOT11IND 2 | ||
109 | /* #define P80211_MSG_CAT_DOT11CFM 3 (doesn't exist at this time) */ | ||
110 | |||
111 | #define P80211SEC_DOT11REQ P80211_MSG_CAT_DOT11REQ | ||
112 | #define P80211SEC_DOT11IND P80211_MSG_CAT_DOT11IND | ||
113 | /* #define P80211SEC_DOT11CFM P80211_MSG_CAT_DOT11CFM (doesn't exist at this time */ | ||
114 | |||
115 | |||
116 | |||
117 | /*----------------------------------------------------------------*/ | ||
118 | /* p80211 DID field codes that represent access type and */ | ||
119 | /* is_table status. */ | ||
120 | |||
121 | #define P80211DID_ACCESS_READ 0x10000000 | ||
122 | #define P80211DID_ACCESS_WRITE 0x08000000 | ||
123 | #define P80211DID_WRITEONLY 0x00000001 | ||
124 | #define P80211DID_READONLY 0x00000002 | ||
125 | #define P80211DID_READWRITE 0x00000003 | ||
126 | #define P80211DID_ISTABLE_FALSE 0 | ||
127 | #define P80211DID_ISTABLE_TRUE 1 | ||
128 | |||
129 | /*----------------------------------------------------------------*/ | ||
130 | /* p80211 enumeration constants. The value to text mappings for */ | ||
131 | /* these is in p80211types.c. These defines were generated */ | ||
132 | /* from the mappings. */ | ||
133 | |||
134 | /* error codes for lookups */ | ||
135 | #define P80211ENUM_BAD 0xffffffffUL | ||
136 | #define P80211ENUM_BADSTR "P80211ENUM_BAD" | ||
137 | |||
138 | #define P80211ENUM_truth_false 0 | ||
139 | #define P80211ENUM_truth_true 1 | ||
140 | #define P80211ENUM_ifstate_disable 0 | ||
141 | #define P80211ENUM_ifstate_fwload 1 | ||
142 | #define P80211ENUM_ifstate_enable 2 | ||
143 | #define P80211ENUM_powermgmt_active 1 | ||
144 | #define P80211ENUM_powermgmt_powersave 2 | ||
145 | #define P80211ENUM_bsstype_infrastructure 1 | ||
146 | #define P80211ENUM_bsstype_independent 2 | ||
147 | #define P80211ENUM_bsstype_any 3 | ||
148 | #define P80211ENUM_authalg_opensystem 1 | ||
149 | #define P80211ENUM_authalg_sharedkey 2 | ||
150 | #define P80211ENUM_phytype_fhss 1 | ||
151 | #define P80211ENUM_phytype_dsss 2 | ||
152 | #define P80211ENUM_phytype_irbaseband 3 | ||
153 | #define P80211ENUM_temptype_commercial 1 | ||
154 | #define P80211ENUM_temptype_industrial 2 | ||
155 | #define P80211ENUM_regdomain_fcc 16 | ||
156 | #define P80211ENUM_regdomain_doc 32 | ||
157 | #define P80211ENUM_regdomain_etsi 48 | ||
158 | #define P80211ENUM_regdomain_spain 49 | ||
159 | #define P80211ENUM_regdomain_france 50 | ||
160 | #define P80211ENUM_regdomain_mkk 64 | ||
161 | #define P80211ENUM_ccamode_edonly 1 | ||
162 | #define P80211ENUM_ccamode_csonly 2 | ||
163 | #define P80211ENUM_ccamode_edandcs 4 | ||
164 | #define P80211ENUM_ccamode_cswithtimer 8 | ||
165 | #define P80211ENUM_ccamode_hrcsanded 16 | ||
166 | #define P80211ENUM_diversity_fixedlist 1 | ||
167 | #define P80211ENUM_diversity_notsupported 2 | ||
168 | #define P80211ENUM_diversity_dynamic 3 | ||
169 | #define P80211ENUM_scantype_active 1 | ||
170 | #define P80211ENUM_scantype_passive 2 | ||
171 | #define P80211ENUM_scantype_both 3 | ||
172 | #define P80211ENUM_resultcode_success 1 | ||
173 | #define P80211ENUM_resultcode_invalid_parameters 2 | ||
174 | #define P80211ENUM_resultcode_not_supported 3 | ||
175 | #define P80211ENUM_resultcode_timeout 4 | ||
176 | #define P80211ENUM_resultcode_too_many_req 5 | ||
177 | #define P80211ENUM_resultcode_refused 6 | ||
178 | #define P80211ENUM_resultcode_bss_already 7 | ||
179 | #define P80211ENUM_resultcode_invalid_access 8 | ||
180 | #define P80211ENUM_resultcode_invalid_mibattribute 9 | ||
181 | #define P80211ENUM_resultcode_cant_set_readonly_mib 10 | ||
182 | #define P80211ENUM_resultcode_implementation_failure 11 | ||
183 | #define P80211ENUM_resultcode_cant_get_writeonly_mib 12 | ||
184 | #define P80211ENUM_reason_unspec_reason 1 | ||
185 | #define P80211ENUM_reason_auth_not_valid 2 | ||
186 | #define P80211ENUM_reason_deauth_lv_ss 3 | ||
187 | #define P80211ENUM_reason_inactivity 4 | ||
188 | #define P80211ENUM_reason_ap_overload 5 | ||
189 | #define P80211ENUM_reason_class23_err 6 | ||
190 | #define P80211ENUM_reason_class3_err 7 | ||
191 | #define P80211ENUM_reason_disas_lv_ss 8 | ||
192 | #define P80211ENUM_reason_asoc_not_auth 9 | ||
193 | #define P80211ENUM_status_successful 0 | ||
194 | #define P80211ENUM_status_unspec_failure 1 | ||
195 | #define P80211ENUM_status_unsup_cap 10 | ||
196 | #define P80211ENUM_status_reasoc_no_asoc 11 | ||
197 | #define P80211ENUM_status_fail_other 12 | ||
198 | #define P80211ENUM_status_unspt_alg 13 | ||
199 | #define P80211ENUM_status_auth_seq_fail 14 | ||
200 | #define P80211ENUM_status_chlng_fail 15 | ||
201 | #define P80211ENUM_status_auth_timeout 16 | ||
202 | #define P80211ENUM_status_ap_full 17 | ||
203 | #define P80211ENUM_status_unsup_rate 18 | ||
204 | #define P80211ENUM_status_unsup_shortpreamble 19 | ||
205 | #define P80211ENUM_status_unsup_pbcc 20 | ||
206 | #define P80211ENUM_status_unsup_agility 21 | ||
207 | #define P80211ENUM_msgitem_status_data_ok 0 | ||
208 | #define P80211ENUM_msgitem_status_no_value 1 | ||
209 | #define P80211ENUM_msgitem_status_invalid_itemname 2 | ||
210 | #define P80211ENUM_msgitem_status_invalid_itemdata 3 | ||
211 | #define P80211ENUM_msgitem_status_missing_itemdata 4 | ||
212 | #define P80211ENUM_msgitem_status_incomplete_itemdata 5 | ||
213 | #define P80211ENUM_msgitem_status_invalid_msg_did 6 | ||
214 | #define P80211ENUM_msgitem_status_invalid_mib_did 7 | ||
215 | #define P80211ENUM_msgitem_status_missing_conv_func 8 | ||
216 | #define P80211ENUM_msgitem_status_string_too_long 9 | ||
217 | #define P80211ENUM_msgitem_status_data_out_of_range 10 | ||
218 | #define P80211ENUM_msgitem_status_string_too_short 11 | ||
219 | #define P80211ENUM_msgitem_status_missing_valid_func 12 | ||
220 | #define P80211ENUM_msgitem_status_unknown 13 | ||
221 | #define P80211ENUM_msgitem_status_invalid_did 14 | ||
222 | #define P80211ENUM_msgitem_status_missing_print_func 15 | ||
223 | |||
224 | #define P80211ENUM_lnxroam_reason_unknown 0 | ||
225 | #define P80211ENUM_lnxroam_reason_beacon 1 | ||
226 | #define P80211ENUM_lnxroam_reason_signal 2 | ||
227 | #define P80211ENUM_lnxroam_reason_txretry 3 | ||
228 | #define P80211ENUM_lnxroam_reason_notjoined 4 | ||
229 | |||
230 | #define P80211ENUM_p2preamble_long 0 | ||
231 | #define P80211ENUM_p2preamble_short 2 | ||
232 | #define P80211ENUM_p2preamble_mixed 3 | ||
233 | |||
234 | /*----------------------------------------------------------------*/ | ||
235 | /* p80211 max length constants for the different pascal strings. */ | ||
236 | |||
237 | #define MAXLEN_PSTR6 (6) /* pascal array of 6 bytes */ | ||
238 | #define MAXLEN_PSTR14 (14) /* pascal array of 14 bytes */ | ||
239 | #define MAXLEN_PSTR32 (32) /* pascal array of 32 bytes */ | ||
240 | #define MAXLEN_PSTR255 (255) /* pascal array of 255 bytes */ | ||
241 | #define MAXLEN_MIBATTRIBUTE (392) /* maximum mibattribute */ | ||
242 | /* where the size of the DATA itself */ | ||
243 | /* is a DID-LEN-DATA triple */ | ||
244 | /* with a max size of 4+4+384 */ | ||
245 | |||
246 | #define P80211_SET_INT(item, value) do { \ | ||
247 | (item).data = (value); \ | ||
248 | (item).status = P80211ENUM_msgitem_status_data_ok; \ | ||
249 | } while(0) | ||
250 | /*----------------------------------------------------------------*/ | ||
251 | /* string constants */ | ||
252 | |||
253 | #define NOT_SET "NOT_SET" | ||
254 | #define NOT_SUPPORTED "NOT_SUPPORTED" | ||
255 | #define UNKNOWN_DATA "UNKNOWN_DATA" | ||
256 | |||
257 | |||
258 | /*--------------------------------------------------------------------*/ | ||
259 | /* Metadata flags */ | ||
260 | |||
261 | /* MSM: Do these belong in p80211meta.h? I'm not sure. */ | ||
262 | |||
263 | #define ISREQUIRED (0x80000000UL) | ||
264 | #define ISREQUEST (0x40000000UL) | ||
265 | #define ISCONFIRM (0x20000000UL) | ||
266 | |||
267 | |||
268 | /*================================================================*/ | ||
269 | /* Macros */ | ||
270 | |||
271 | /*--------------------------------------------------------------------*/ | ||
272 | /* The following macros are used to manipulate the 'flags' field in */ | ||
273 | /* the metadata. These are only used when the metadata is for */ | ||
274 | /* command arguments to determine if the data item is required, and */ | ||
275 | /* whether the metadata item is for a request command, confirm */ | ||
276 | /* command or both. */ | ||
277 | /*--------------------------------------------------------------------*/ | ||
278 | /* MSM: Do these belong in p80211meta.h? I'm not sure */ | ||
279 | |||
280 | #define P80211ITEM_SETFLAGS(q, r, c) ( q | r | c ) | ||
281 | |||
282 | #define P80211ITEM_ISREQUIRED(flags) (((UINT32)(flags & ISREQUIRED)) >> 31 ) | ||
283 | #define P80211ITEM_ISREQUEST(flags) (((UINT32)(flags & ISREQUEST)) >> 30 ) | ||
284 | #define P80211ITEM_ISCONFIRM(flags) (((UINT32)(flags & ISCONFIRM)) >> 29 ) | ||
285 | |||
286 | /*----------------------------------------------------------------*/ | ||
287 | /* The following macro creates a name for an enum */ | ||
288 | |||
289 | #define MKENUMNAME(name) p80211enum_ ## name | ||
290 | |||
291 | /*---------------------------------------------------------------- | ||
292 | * The following constants and macros are used to construct and | ||
293 | * deconstruct the Data ID codes. The coding is as follows: | ||
294 | * | ||
295 | * ...rwtnnnnnnnniiiiiiggggggssssss s - Section | ||
296 | * g - Group | ||
297 | * i - Item | ||
298 | * n - Index | ||
299 | * t - Table flag | ||
300 | * w - Write flag | ||
301 | * r - Read flag | ||
302 | * . - Unused | ||
303 | */ | ||
304 | |||
305 | #define P80211DID_INVALID 0xffffffffUL | ||
306 | #define P80211DID_VALID 0x00000000UL | ||
307 | |||
308 | #define P80211DID_LSB_SECTION (0) | ||
309 | #define P80211DID_LSB_GROUP (6) | ||
310 | #define P80211DID_LSB_ITEM (12) | ||
311 | #define P80211DID_LSB_INDEX (18) | ||
312 | #define P80211DID_LSB_ISTABLE (26) | ||
313 | #define P80211DID_LSB_ACCESS (27) | ||
314 | |||
315 | #define P80211DID_MASK_SECTION (0x0000003fUL) | ||
316 | #define P80211DID_MASK_GROUP (0x0000003fUL) | ||
317 | #define P80211DID_MASK_ITEM (0x0000003fUL) | ||
318 | #define P80211DID_MASK_INDEX (0x000000ffUL) | ||
319 | #define P80211DID_MASK_ISTABLE (0x00000001UL) | ||
320 | #define P80211DID_MASK_ACCESS (0x00000003UL) | ||
321 | |||
322 | |||
323 | #define P80211DID_MK(a,m,l) ((((UINT32)(a)) & (m)) << (l)) | ||
324 | |||
325 | #define P80211DID_MKSECTION(a) P80211DID_MK(a, \ | ||
326 | P80211DID_MASK_SECTION, \ | ||
327 | P80211DID_LSB_SECTION ) | ||
328 | #define P80211DID_MKGROUP(a) P80211DID_MK(a, \ | ||
329 | P80211DID_MASK_GROUP, \ | ||
330 | P80211DID_LSB_GROUP ) | ||
331 | #define P80211DID_MKITEM(a) P80211DID_MK(a, \ | ||
332 | P80211DID_MASK_ITEM, \ | ||
333 | P80211DID_LSB_ITEM ) | ||
334 | #define P80211DID_MKINDEX(a) P80211DID_MK(a, \ | ||
335 | P80211DID_MASK_INDEX, \ | ||
336 | P80211DID_LSB_INDEX ) | ||
337 | #define P80211DID_MKISTABLE(a) P80211DID_MK(a, \ | ||
338 | P80211DID_MASK_ISTABLE, \ | ||
339 | P80211DID_LSB_ISTABLE ) | ||
340 | |||
341 | |||
342 | #define P80211DID_MKID(s,g,i,n,t,a) (P80211DID_MKSECTION(s) | \ | ||
343 | P80211DID_MKGROUP(g) | \ | ||
344 | P80211DID_MKITEM(i) | \ | ||
345 | P80211DID_MKINDEX(n) | \ | ||
346 | P80211DID_MKISTABLE(t) | \ | ||
347 | (a) ) | ||
348 | |||
349 | |||
350 | #define P80211DID_GET(a,m,l) ((((UINT32)(a)) >> (l)) & (m)) | ||
351 | |||
352 | #define P80211DID_SECTION(a) P80211DID_GET(a, \ | ||
353 | P80211DID_MASK_SECTION, \ | ||
354 | P80211DID_LSB_SECTION) | ||
355 | #define P80211DID_GROUP(a) P80211DID_GET(a, \ | ||
356 | P80211DID_MASK_GROUP, \ | ||
357 | P80211DID_LSB_GROUP) | ||
358 | #define P80211DID_ITEM(a) P80211DID_GET(a, \ | ||
359 | P80211DID_MASK_ITEM, \ | ||
360 | P80211DID_LSB_ITEM) | ||
361 | #define P80211DID_INDEX(a) P80211DID_GET(a, \ | ||
362 | P80211DID_MASK_INDEX, \ | ||
363 | P80211DID_LSB_INDEX) | ||
364 | #define P80211DID_ISTABLE(a) P80211DID_GET(a, \ | ||
365 | P80211DID_MASK_ISTABLE, \ | ||
366 | P80211DID_LSB_ISTABLE) | ||
367 | #define P80211DID_ACCESS(a) P80211DID_GET(a, \ | ||
368 | P80211DID_MASK_ACCESS, \ | ||
369 | P80211DID_LSB_ACCESS) | ||
370 | |||
371 | /*================================================================*/ | ||
372 | /* Types */ | ||
373 | |||
374 | /*----------------------------------------------------------------*/ | ||
375 | /* The following structure types are used for the represenation */ | ||
376 | /* of ENUMINT type metadata. */ | ||
377 | |||
378 | typedef struct p80211enumpair | ||
379 | { | ||
380 | UINT32 val; | ||
381 | char *name; | ||
382 | } p80211enumpair_t; | ||
383 | |||
384 | typedef struct p80211enum | ||
385 | { | ||
386 | INT nitems; | ||
387 | p80211enumpair_t *list; | ||
388 | } p80211enum_t; | ||
389 | |||
390 | /*----------------------------------------------------------------*/ | ||
391 | /* The following structure types are used to store data items in */ | ||
392 | /* messages. */ | ||
393 | |||
394 | /* Template pascal string */ | ||
395 | typedef struct p80211pstr | ||
396 | { | ||
397 | UINT8 len; | ||
398 | } __WLAN_ATTRIB_PACK__ p80211pstr_t; | ||
399 | |||
400 | typedef struct p80211pstrd | ||
401 | { | ||
402 | UINT8 len; | ||
403 | UINT8 data[0]; | ||
404 | } __WLAN_ATTRIB_PACK__ p80211pstrd_t; | ||
405 | |||
406 | /* Maximum pascal string */ | ||
407 | typedef struct p80211pstr255 | ||
408 | { | ||
409 | UINT8 len; | ||
410 | UINT8 data[MAXLEN_PSTR255]; | ||
411 | } __WLAN_ATTRIB_PACK__ p80211pstr255_t; | ||
412 | |||
413 | /* pascal string for macaddress and bssid */ | ||
414 | typedef struct p80211pstr6 | ||
415 | { | ||
416 | UINT8 len; | ||
417 | UINT8 data[MAXLEN_PSTR6]; | ||
418 | } __WLAN_ATTRIB_PACK__ p80211pstr6_t; | ||
419 | |||
420 | /* pascal string for channel list */ | ||
421 | typedef struct p80211pstr14 | ||
422 | { | ||
423 | UINT8 len; | ||
424 | UINT8 data[MAXLEN_PSTR14]; | ||
425 | } __WLAN_ATTRIB_PACK__ p80211pstr14_t; | ||
426 | |||
427 | /* pascal string for ssid */ | ||
428 | typedef struct p80211pstr32 | ||
429 | { | ||
430 | UINT8 len; | ||
431 | UINT8 data[MAXLEN_PSTR32]; | ||
432 | } __WLAN_ATTRIB_PACK__ p80211pstr32_t; | ||
433 | |||
434 | /* MAC address array */ | ||
435 | typedef struct p80211macarray | ||
436 | { | ||
437 | UINT32 cnt; | ||
438 | UINT8 data[1][MAXLEN_PSTR6]; | ||
439 | } __WLAN_ATTRIB_PACK__ p80211macarray_t; | ||
440 | |||
441 | /* prototype template */ | ||
442 | typedef struct p80211item | ||
443 | { | ||
444 | UINT32 did; | ||
445 | UINT16 status; | ||
446 | UINT16 len; | ||
447 | } __WLAN_ATTRIB_PACK__ p80211item_t; | ||
448 | |||
449 | /* prototype template w/ data item */ | ||
450 | typedef struct p80211itemd | ||
451 | { | ||
452 | UINT32 did; | ||
453 | UINT16 status; | ||
454 | UINT16 len; | ||
455 | UINT8 data[0]; | ||
456 | } __WLAN_ATTRIB_PACK__ p80211itemd_t; | ||
457 | |||
458 | /* message data item for INT, BOUNDEDINT, ENUMINT */ | ||
459 | typedef struct p80211item_uint32 | ||
460 | { | ||
461 | UINT32 did; | ||
462 | UINT16 status; | ||
463 | UINT16 len; | ||
464 | UINT32 data; | ||
465 | } __WLAN_ATTRIB_PACK__ p80211item_uint32_t; | ||
466 | |||
467 | /* message data item for OCTETSTR, DISPLAYSTR */ | ||
468 | typedef struct p80211item_pstr6 | ||
469 | { | ||
470 | UINT32 did; | ||
471 | UINT16 status; | ||
472 | UINT16 len; | ||
473 | p80211pstr6_t data; | ||
474 | } __WLAN_ATTRIB_PACK__ p80211item_pstr6_t; | ||
475 | |||
476 | /* message data item for OCTETSTR, DISPLAYSTR */ | ||
477 | typedef struct p80211item_pstr14 | ||
478 | { | ||
479 | UINT32 did; | ||
480 | UINT16 status; | ||
481 | UINT16 len; | ||
482 | p80211pstr14_t data; | ||
483 | } __WLAN_ATTRIB_PACK__ p80211item_pstr14_t; | ||
484 | |||
485 | /* message data item for OCTETSTR, DISPLAYSTR */ | ||
486 | typedef struct p80211item_pstr32 | ||
487 | { | ||
488 | UINT32 did; | ||
489 | UINT16 status; | ||
490 | UINT16 len; | ||
491 | p80211pstr32_t data; | ||
492 | } __WLAN_ATTRIB_PACK__ p80211item_pstr32_t; | ||
493 | |||
494 | /* message data item for OCTETSTR, DISPLAYSTR */ | ||
495 | typedef struct p80211item_pstr255 | ||
496 | { | ||
497 | UINT32 did; | ||
498 | UINT16 status; | ||
499 | UINT16 len; | ||
500 | p80211pstr255_t data; | ||
501 | } __WLAN_ATTRIB_PACK__ p80211item_pstr255_t; | ||
502 | |||
503 | /* message data item for UNK 392, namely mib items */ | ||
504 | typedef struct p80211item_unk392 | ||
505 | { | ||
506 | UINT32 did; | ||
507 | UINT16 status; | ||
508 | UINT16 len; | ||
509 | UINT8 data[MAXLEN_MIBATTRIBUTE]; | ||
510 | } __WLAN_ATTRIB_PACK__ p80211item_unk392_t; | ||
511 | |||
512 | /* message data item for UNK 1025, namely p2 pdas */ | ||
513 | typedef struct p80211item_unk1024 | ||
514 | { | ||
515 | UINT32 did; | ||
516 | UINT16 status; | ||
517 | UINT16 len; | ||
518 | UINT8 data[1024]; | ||
519 | } __WLAN_ATTRIB_PACK__ p80211item_unk1024_t; | ||
520 | |||
521 | /* message data item for UNK 4096, namely p2 download chunks */ | ||
522 | typedef struct p80211item_unk4096 | ||
523 | { | ||
524 | UINT32 did; | ||
525 | UINT16 status; | ||
526 | UINT16 len; | ||
527 | UINT8 data[4096]; | ||
528 | } __WLAN_ATTRIB_PACK__ p80211item_unk4096_t; | ||
529 | |||
530 | struct catlistitem; | ||
531 | |||
532 | /*----------------------------------------------------------------*/ | ||
533 | /* The following structure type is used to represent all of the */ | ||
534 | /* metadata items. Some components may choose to use more, */ | ||
535 | /* less or different metadata items. */ | ||
536 | |||
537 | typedef void (*p80211_totext_t)( struct catlistitem *, UINT32 did, UINT8* itembuf, char *textbuf); | ||
538 | typedef void (*p80211_fromtext_t)( struct catlistitem *, UINT32 did, UINT8* itembuf, char *textbuf); | ||
539 | typedef UINT32 (*p80211_valid_t)( struct catlistitem *, UINT32 did, UINT8* itembuf); | ||
540 | |||
541 | |||
542 | /*================================================================*/ | ||
543 | /* Extern Declarations */ | ||
544 | |||
545 | /*----------------------------------------------------------------*/ | ||
546 | /* Enumeration Lists */ | ||
547 | /* The following are the external declarations */ | ||
548 | /* for all enumerations */ | ||
549 | |||
550 | extern p80211enum_t MKENUMNAME(truth); | ||
551 | extern p80211enum_t MKENUMNAME(ifstate); | ||
552 | extern p80211enum_t MKENUMNAME(powermgmt); | ||
553 | extern p80211enum_t MKENUMNAME(bsstype); | ||
554 | extern p80211enum_t MKENUMNAME(authalg); | ||
555 | extern p80211enum_t MKENUMNAME(phytype); | ||
556 | extern p80211enum_t MKENUMNAME(temptype); | ||
557 | extern p80211enum_t MKENUMNAME(regdomain); | ||
558 | extern p80211enum_t MKENUMNAME(ccamode); | ||
559 | extern p80211enum_t MKENUMNAME(diversity); | ||
560 | extern p80211enum_t MKENUMNAME(scantype); | ||
561 | extern p80211enum_t MKENUMNAME(resultcode); | ||
562 | extern p80211enum_t MKENUMNAME(reason); | ||
563 | extern p80211enum_t MKENUMNAME(status); | ||
564 | extern p80211enum_t MKENUMNAME(msgcode); | ||
565 | extern p80211enum_t MKENUMNAME(msgitem_status); | ||
566 | |||
567 | extern p80211enum_t MKENUMNAME(lnxroam_reason); | ||
568 | |||
569 | extern p80211enum_t MKENUMNAME(p2preamble); | ||
570 | |||
571 | /*================================================================*/ | ||
572 | /* Function Declarations */ | ||
573 | |||
574 | /*----------------------------------------------------------------*/ | ||
575 | /* The following declare some utility functions for use with the */ | ||
576 | /* p80211enum_t type. */ | ||
577 | |||
578 | UINT32 p80211enum_text2int(p80211enum_t *ep, char *text); | ||
579 | UINT32 p80211enum_int2text(p80211enum_t *ep, UINT32 val, char *text); | ||
580 | void p80211_error2text(int err_code, char *err_str); | ||
581 | |||
582 | /*----------------------------------------------------------------*/ | ||
583 | /* The following declare some utility functions for use with the */ | ||
584 | /* p80211item_t and p80211meta_t types. */ | ||
585 | |||
586 | /*----------------------------------------------------------------*/ | ||
587 | /* The following declare functions that perform validation and */ | ||
588 | /* text to binary conversions based on the metadata for interface */ | ||
589 | /* and MIB data items. */ | ||
590 | /*----------------------------------------------------------------*/ | ||
591 | |||
592 | /*-- DISPLAYSTR ------------------------------------------------------*/ | ||
593 | /* pstr ==> cstr */ | ||
594 | void p80211_totext_displaystr( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
595 | |||
596 | /* cstr ==> pstr */ | ||
597 | void p80211_fromtext_displaystr( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
598 | |||
599 | /* function that checks validity of a displaystr binary value */ | ||
600 | UINT32 p80211_isvalid_displaystr( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
601 | |||
602 | /*-- OCTETSTR --------------------------------------------------------*/ | ||
603 | /* pstr ==> "xx:xx:...." */ | ||
604 | void p80211_totext_octetstr( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
605 | |||
606 | /* "xx:xx:...." ==> pstr */ | ||
607 | void p80211_fromtext_octetstr( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
608 | |||
609 | /* function that checks validity of an octetstr binary value */ | ||
610 | UINT32 p80211_isvalid_octetstr( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
611 | |||
612 | /*-- INT -------------------------------------------------------------*/ | ||
613 | /* UINT32 ==> %d */ | ||
614 | void p80211_totext_int( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
615 | |||
616 | /* %d ==> UINT32 */ | ||
617 | void p80211_fromtext_int( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
618 | |||
619 | /* function that checks validity of an int's binary value (always successful) */ | ||
620 | UINT32 p80211_isvalid_int( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
621 | |||
622 | /*-- ENUMINT ---------------------------------------------------------*/ | ||
623 | /* UINT32 ==> <valuename> */ | ||
624 | void p80211_totext_enumint( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
625 | |||
626 | /* <valuename> ==> UINT32 */ | ||
627 | void p80211_fromtext_enumint( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
628 | |||
629 | /* function that checks validity of an enum's binary value */ | ||
630 | UINT32 p80211_isvalid_enumint( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
631 | |||
632 | /*-- INTARRAY --------------------------------------------------------*/ | ||
633 | /* UINT32[] => %d,%d,%d,... */ | ||
634 | void p80211_totext_intarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
635 | |||
636 | /* %d,%d,%d,... ==> UINT32[] */ | ||
637 | void p80211_fromtext_intarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
638 | |||
639 | /* function that checks validity of an integer array's value */ | ||
640 | UINT32 p80211_isvalid_intarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
641 | |||
642 | /*-- BITARRAY --------------------------------------------------------*/ | ||
643 | /* UINT32 ==> %d,%d,%d,... */ | ||
644 | void p80211_totext_bitarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
645 | |||
646 | /* %d,%d,%d,... ==> UINT32 */ | ||
647 | void p80211_fromtext_bitarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
648 | |||
649 | /* function that checks validity of a bit array's value */ | ||
650 | UINT32 p80211_isvalid_bitarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
651 | |||
652 | /*-- MACARRAY --------------------------------------------------------*/ | ||
653 | void p80211_totext_macarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
654 | |||
655 | void p80211_fromtext_macarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
656 | |||
657 | /* function that checks validity of a MAC address array's value */ | ||
658 | UINT32 p80211_isvalid_macarray( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
659 | |||
660 | /*-- MIBATTRIUBTE ------------------------------------------------------*/ | ||
661 | /* <mibvalue> ==> <textual representation identified in MIB metadata> */ | ||
662 | void p80211_totext_getmibattribute( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
663 | void p80211_totext_setmibattribute( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
664 | |||
665 | |||
666 | /* <textual representation identified in MIB metadata> ==> <mibvalue> */ | ||
667 | void p80211_fromtext_getmibattribute( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
668 | void p80211_fromtext_setmibattribute( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf, char *textbuf ); | ||
669 | |||
670 | /* function that checks validity of a mibitem's binary value */ | ||
671 | UINT32 p80211_isvalid_getmibattribute( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
672 | UINT32 p80211_isvalid_setmibattribute( struct catlistitem *metalist, UINT32 did, UINT8 *itembuf ); | ||
673 | |||
674 | #endif /* _P80211TYPES_H */ | ||
675 | |||
diff --git a/drivers/staging/wlan-ng/p80211wep.c b/drivers/staging/wlan-ng/p80211wep.c new file mode 100644 index 000000000000..53fe2985971f --- /dev/null +++ b/drivers/staging/wlan-ng/p80211wep.c | |||
@@ -0,0 +1,317 @@ | |||
1 | /* src/p80211/p80211wep.c | ||
2 | * | ||
3 | * WEP encode/decode for P80211. | ||
4 | * | ||
5 | * Copyright (C) 2002 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | */ | ||
47 | |||
48 | /*================================================================*/ | ||
49 | /* System Includes */ | ||
50 | |||
51 | |||
52 | #include <linux/version.h> | ||
53 | |||
54 | #include <linux/netdevice.h> | ||
55 | #include <linux/wireless.h> | ||
56 | #include <linux/slab.h> | ||
57 | #include <linux/random.h> | ||
58 | |||
59 | #include "version.h" | ||
60 | #include "wlan_compat.h" | ||
61 | |||
62 | // #define WEP_DEBUG | ||
63 | |||
64 | /*================================================================*/ | ||
65 | /* Project Includes */ | ||
66 | |||
67 | #include "version.h" | ||
68 | #include "p80211hdr.h" | ||
69 | #include "p80211types.h" | ||
70 | #include "p80211msg.h" | ||
71 | #include "p80211conv.h" | ||
72 | #include "p80211netdev.h" | ||
73 | |||
74 | /*================================================================*/ | ||
75 | /* Local Constants */ | ||
76 | |||
77 | #define SSWAP(a,b) {UINT8 tmp = s[a]; s[a] = s[b]; s[b] = tmp;} | ||
78 | #define WEP_KEY(x) (((x) & 0xC0) >> 6) | ||
79 | |||
80 | /*================================================================*/ | ||
81 | /* Local Macros */ | ||
82 | |||
83 | |||
84 | /*================================================================*/ | ||
85 | /* Local Types */ | ||
86 | |||
87 | |||
88 | /*================================================================*/ | ||
89 | /* Local Static Definitions */ | ||
90 | |||
91 | static const UINT32 wep_crc32_table[256] = { | ||
92 | 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, | ||
93 | 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, | ||
94 | 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, | ||
95 | 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, | ||
96 | 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, | ||
97 | 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, | ||
98 | 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, | ||
99 | 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, | ||
100 | 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, | ||
101 | 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, | ||
102 | 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, | ||
103 | 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, | ||
104 | 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, | ||
105 | 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, | ||
106 | 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, | ||
107 | 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, | ||
108 | 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, | ||
109 | 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, | ||
110 | 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, | ||
111 | 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, | ||
112 | 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, | ||
113 | 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, | ||
114 | 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, | ||
115 | 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, | ||
116 | 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, | ||
117 | 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, | ||
118 | 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, | ||
119 | 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, | ||
120 | 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, | ||
121 | 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, | ||
122 | 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, | ||
123 | 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, | ||
124 | 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, | ||
125 | 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, | ||
126 | 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, | ||
127 | 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, | ||
128 | 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, | ||
129 | 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, | ||
130 | 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, | ||
131 | 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, | ||
132 | 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, | ||
133 | 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, | ||
134 | 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, | ||
135 | 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, | ||
136 | 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, | ||
137 | 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, | ||
138 | 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, | ||
139 | 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, | ||
140 | 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, | ||
141 | 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, | ||
142 | 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, | ||
143 | 0x2d02ef8dL | ||
144 | }; | ||
145 | |||
146 | /*================================================================*/ | ||
147 | /* Local Function Declarations */ | ||
148 | |||
149 | /*================================================================*/ | ||
150 | /* Function Definitions */ | ||
151 | |||
152 | /* keylen in bytes! */ | ||
153 | |||
154 | int wep_change_key(wlandevice_t *wlandev, int keynum, UINT8* key, int keylen) | ||
155 | { | ||
156 | if (keylen < 0) return -1; | ||
157 | if (keylen >= MAX_KEYLEN) return -1; | ||
158 | if (key == NULL) return -1; | ||
159 | if (keynum < 0) return -1; | ||
160 | if (keynum >= NUM_WEPKEYS) return -1; | ||
161 | |||
162 | |||
163 | #ifdef WEP_DEBUG | ||
164 | printk(KERN_DEBUG "WEP key %d len %d = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", keynum, keylen, key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]); | ||
165 | #endif | ||
166 | |||
167 | wlandev->wep_keylens[keynum] = keylen; | ||
168 | memcpy(wlandev->wep_keys[keynum], key, keylen); | ||
169 | |||
170 | return 0; | ||
171 | } | ||
172 | |||
173 | /* | ||
174 | 4-byte IV at start of buffer, 4-byte ICV at end of buffer. | ||
175 | if successful, buf start is payload begin, length -= 8; | ||
176 | */ | ||
177 | int wep_decrypt(wlandevice_t *wlandev, UINT8 *buf, UINT32 len, int key_override, UINT8 *iv, UINT8 *icv) | ||
178 | { | ||
179 | UINT32 i, j, k, crc, keylen; | ||
180 | UINT8 s[256], key[64], c_crc[4]; | ||
181 | UINT8 keyidx; | ||
182 | |||
183 | /* Needs to be at least 8 bytes of payload */ | ||
184 | if (len <= 0) return -1; | ||
185 | |||
186 | /* initialize the first bytes of the key from the IV */ | ||
187 | key[0] = iv[0]; | ||
188 | key[1] = iv[1]; | ||
189 | key[2] = iv[2]; | ||
190 | keyidx = WEP_KEY(iv[3]); | ||
191 | |||
192 | if (key_override >= 0) | ||
193 | keyidx = key_override; | ||
194 | |||
195 | if (keyidx >= NUM_WEPKEYS) return -2; | ||
196 | |||
197 | keylen = wlandev->wep_keylens[keyidx]; | ||
198 | |||
199 | if (keylen == 0) return -3; | ||
200 | |||
201 | /* copy the rest of the key over from the designated key */ | ||
202 | memcpy(key+3, wlandev->wep_keys[keyidx], keylen); | ||
203 | |||
204 | keylen+=3; /* add in IV bytes */ | ||
205 | |||
206 | #ifdef WEP_DEBUG | ||
207 | printk(KERN_DEBUG "D %d: %02x %02x %02x (%d %d) %02x:%02x:%02x:%02x:%02x\n", len, key[0], key[1], key[2], keyidx, keylen, key[3], key[4], key[5], key[6], key[7]); | ||
208 | #endif | ||
209 | |||
210 | /* set up the RC4 state */ | ||
211 | for (i = 0; i < 256; i++) | ||
212 | s[i] = i; | ||
213 | j = 0; | ||
214 | for (i = 0; i < 256; i++) { | ||
215 | j = (j + s[i] + key[i % keylen]) & 0xff; | ||
216 | SSWAP(i,j); | ||
217 | } | ||
218 | |||
219 | /* Apply the RC4 to the data, update the CRC32 */ | ||
220 | crc = ~0; | ||
221 | i = j = 0; | ||
222 | for (k = 0; k < len; k++) { | ||
223 | i = (i+1) & 0xff; | ||
224 | j = (j+s[i]) & 0xff; | ||
225 | SSWAP(i,j); | ||
226 | buf[k] ^= s[(s[i] + s[j]) & 0xff]; | ||
227 | crc = wep_crc32_table[(crc ^ buf[k]) & 0xff] ^ (crc >> 8); | ||
228 | } | ||
229 | crc = ~crc; | ||
230 | |||
231 | /* now let's check the crc */ | ||
232 | c_crc[0] = crc; | ||
233 | c_crc[1] = crc >> 8; | ||
234 | c_crc[2] = crc >> 16; | ||
235 | c_crc[3] = crc >> 24; | ||
236 | |||
237 | for (k = 0; k < 4; k++) { | ||
238 | i = (i + 1) & 0xff; | ||
239 | j = (j+s[i]) & 0xff; | ||
240 | SSWAP(i,j); | ||
241 | if ((c_crc[k] ^ s[(s[i] + s[j]) & 0xff]) != icv[k]) | ||
242 | return -(4 | (k << 4)) ; /* ICV mismatch */ | ||
243 | } | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | /* encrypts in-place. */ | ||
249 | int wep_encrypt(wlandevice_t *wlandev, UINT8 *buf, UINT8 *dst, UINT32 len, int keynum, UINT8 *iv, UINT8 *icv) | ||
250 | { | ||
251 | UINT32 i, j, k, crc, keylen; | ||
252 | UINT8 s[256], key[64]; | ||
253 | |||
254 | /* no point in WEPping an empty frame */ | ||
255 | if (len <= 0) return -1; | ||
256 | |||
257 | /* we need to have a real key.. */ | ||
258 | if (keynum >= NUM_WEPKEYS) return -2; | ||
259 | keylen = wlandev->wep_keylens[keynum]; | ||
260 | if (keylen <= 0) return -3; | ||
261 | |||
262 | /* use a random IV. And skip known weak ones. */ | ||
263 | get_random_bytes(iv, 3); | ||
264 | while ((iv[1] == 0xff) && (iv[0] >= 3) && (iv[0] < keylen)) | ||
265 | get_random_bytes(iv, 3); | ||
266 | |||
267 | iv[3] = (keynum & 0x03) << 6; | ||
268 | |||
269 | key[0] = iv[0]; | ||
270 | key[1] = iv[1]; | ||
271 | key[2] = iv[2]; | ||
272 | |||
273 | /* copy the rest of the key over from the designated key */ | ||
274 | memcpy(key+3, wlandev->wep_keys[keynum], keylen); | ||
275 | |||
276 | keylen+=3; /* add in IV bytes */ | ||
277 | |||
278 | #ifdef WEP_DEBUG | ||
279 | printk(KERN_DEBUG "E %d (%d/%d %d) %02x %02x %02x %02x:%02x:%02x:%02x:%02x\n", len, iv[3], keynum, keylen, key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]); | ||
280 | #endif | ||
281 | |||
282 | /* set up the RC4 state */ | ||
283 | for (i = 0; i < 256; i++) | ||
284 | s[i] = i; | ||
285 | j = 0; | ||
286 | for (i = 0; i < 256; i++) { | ||
287 | j = (j + s[i] + key[i % keylen]) & 0xff; | ||
288 | SSWAP(i,j); | ||
289 | } | ||
290 | |||
291 | /* Update CRC32 then apply RC4 to the data */ | ||
292 | crc = ~0; | ||
293 | i = j = 0; | ||
294 | for (k = 0; k < len; k++) { | ||
295 | crc = wep_crc32_table[(crc ^ buf[k]) & 0xff] ^ (crc >> 8); | ||
296 | i = (i+1) & 0xff; | ||
297 | j = (j+s[i]) & 0xff; | ||
298 | SSWAP(i,j); | ||
299 | dst[k] = buf[k] ^ s[(s[i] + s[j]) & 0xff]; | ||
300 | } | ||
301 | crc = ~crc; | ||
302 | |||
303 | /* now let's encrypt the crc */ | ||
304 | icv[0] = crc; | ||
305 | icv[1] = crc >> 8; | ||
306 | icv[2] = crc >> 16; | ||
307 | icv[3] = crc >> 24; | ||
308 | |||
309 | for (k = 0; k < 4; k++) { | ||
310 | i = (i + 1) & 0xff; | ||
311 | j = (j+s[i]) & 0xff; | ||
312 | SSWAP(i,j); | ||
313 | icv[k] ^= s[(s[i] + s[j]) & 0xff]; | ||
314 | } | ||
315 | |||
316 | return 0; | ||
317 | } | ||
diff --git a/drivers/staging/wlan-ng/p80211wext.c b/drivers/staging/wlan-ng/p80211wext.c new file mode 100644 index 000000000000..906ba4392376 --- /dev/null +++ b/drivers/staging/wlan-ng/p80211wext.c | |||
@@ -0,0 +1,2048 @@ | |||
1 | /* src/p80211/p80211wext.c | ||
2 | * | ||
3 | * Glue code to make linux-wlan-ng a happy wireless extension camper. | ||
4 | * | ||
5 | * original author: Reyk Floeter <reyk@synack.de> | ||
6 | * Completely re-written by Solomon Peachy <solomon@linux-wlan.com> | ||
7 | * | ||
8 | * Copyright (C) 2002 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
9 | * -------------------------------------------------------------------- | ||
10 | * | ||
11 | * linux-wlan | ||
12 | * | ||
13 | * The contents of this file are subject to the Mozilla Public | ||
14 | * License Version 1.1 (the "License"); you may not use this file | ||
15 | * except in compliance with the License. You may obtain a copy of | ||
16 | * the License at http://www.mozilla.org/MPL/ | ||
17 | * | ||
18 | * Software distributed under the License is distributed on an "AS | ||
19 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
20 | * implied. See the License for the specific language governing | ||
21 | * rights and limitations under the License. | ||
22 | * | ||
23 | * Alternatively, the contents of this file may be used under the | ||
24 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
25 | * case the provisions of the GPL are applicable instead of the | ||
26 | * above. If you wish to allow the use of your version of this file | ||
27 | * only under the terms of the GPL and not to allow others to use | ||
28 | * your version of this file under the MPL, indicate your decision | ||
29 | * by deleting the provisions above and replace them with the notice | ||
30 | * and other provisions required by the GPL. If you do not delete | ||
31 | * the provisions above, a recipient may use your version of this | ||
32 | * file under either the MPL or the GPL. | ||
33 | * | ||
34 | * -------------------------------------------------------------------- | ||
35 | */ | ||
36 | |||
37 | /*================================================================*/ | ||
38 | /* System Includes */ | ||
39 | |||
40 | |||
41 | #include <linux/version.h> | ||
42 | |||
43 | #include <linux/kernel.h> | ||
44 | #include <linux/sched.h> | ||
45 | #include <linux/types.h> | ||
46 | #include <linux/slab.h> | ||
47 | #include <linux/netdevice.h> | ||
48 | #include <linux/etherdevice.h> | ||
49 | #include <linux/wireless.h> | ||
50 | #if WIRELESS_EXT > 12 | ||
51 | #include <net/iw_handler.h> | ||
52 | #endif | ||
53 | #include <linux/if_arp.h> | ||
54 | #include <asm/bitops.h> | ||
55 | #include <asm/uaccess.h> | ||
56 | #include <asm/byteorder.h> | ||
57 | |||
58 | /*================================================================*/ | ||
59 | /* Project Includes */ | ||
60 | |||
61 | #include "version.h" | ||
62 | #include "wlan_compat.h" | ||
63 | |||
64 | #include "p80211types.h" | ||
65 | #include "p80211hdr.h" | ||
66 | #include "p80211conv.h" | ||
67 | #include "p80211mgmt.h" | ||
68 | #include "p80211msg.h" | ||
69 | #include "p80211metastruct.h" | ||
70 | #include "p80211metadef.h" | ||
71 | #include "p80211netdev.h" | ||
72 | #include "p80211ioctl.h" | ||
73 | #include "p80211req.h" | ||
74 | |||
75 | static int p80211wext_giwrate(netdevice_t *dev, | ||
76 | struct iw_request_info *info, | ||
77 | struct iw_param *rrq, char *extra); | ||
78 | static int p80211wext_giwessid(netdevice_t *dev, | ||
79 | struct iw_request_info *info, | ||
80 | struct iw_point *data, char *essid); | ||
81 | /* compatibility to wireless extensions */ | ||
82 | #ifdef WIRELESS_EXT | ||
83 | |||
84 | static UINT8 p80211_mhz_to_channel(UINT16 mhz) | ||
85 | { | ||
86 | if (mhz >= 5000) { | ||
87 | return ((mhz - 5000) / 5); | ||
88 | } | ||
89 | |||
90 | if (mhz == 2482) | ||
91 | return 14; | ||
92 | |||
93 | if (mhz >= 2407) { | ||
94 | return ((mhz - 2407) / 5); | ||
95 | } | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static UINT16 p80211_channel_to_mhz(UINT8 ch, int dot11a) | ||
101 | { | ||
102 | |||
103 | if (ch == 0) | ||
104 | return 0; | ||
105 | if (ch > 200) | ||
106 | return 0; | ||
107 | |||
108 | /* 5G */ | ||
109 | |||
110 | if (dot11a) { | ||
111 | return (5000 + (5 * ch)); | ||
112 | } | ||
113 | |||
114 | /* 2.4G */ | ||
115 | |||
116 | if (ch == 14) | ||
117 | return 2484; | ||
118 | |||
119 | if ((ch < 14) && (ch > 0)) { | ||
120 | return (2407 + (5 * ch)); | ||
121 | } | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | /* taken from orinoco.c ;-) */ | ||
127 | static const long p80211wext_channel_freq[] = { | ||
128 | 2412, 2417, 2422, 2427, 2432, 2437, 2442, | ||
129 | 2447, 2452, 2457, 2462, 2467, 2472, 2484 | ||
130 | }; | ||
131 | #define NUM_CHANNELS (sizeof(p80211wext_channel_freq) / sizeof(p80211wext_channel_freq[0])) | ||
132 | |||
133 | /* steal a spare bit to store the shared/opensystems state. should default to open if not set */ | ||
134 | #define HOSTWEP_SHAREDKEY BIT3 | ||
135 | |||
136 | |||
137 | /** function declarations =============== */ | ||
138 | |||
139 | static int qual_as_percent(int snr ) { | ||
140 | if ( snr <= 0 ) | ||
141 | return 0; | ||
142 | if ( snr <= 40 ) | ||
143 | return snr*5/2; | ||
144 | return 100; | ||
145 | } | ||
146 | |||
147 | |||
148 | |||
149 | |||
150 | static int p80211wext_dorequest(wlandevice_t *wlandev, UINT32 did, UINT32 data) | ||
151 | { | ||
152 | p80211msg_dot11req_mibset_t msg; | ||
153 | p80211item_uint32_t mibitem; | ||
154 | int result; | ||
155 | |||
156 | DBFENTER; | ||
157 | |||
158 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
159 | mibitem.did = did; | ||
160 | mibitem.data = data; | ||
161 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
162 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
163 | |||
164 | DBFEXIT; | ||
165 | return result; | ||
166 | } | ||
167 | |||
168 | static int p80211wext_autojoin(wlandevice_t *wlandev) | ||
169 | { | ||
170 | p80211msg_lnxreq_autojoin_t msg; | ||
171 | struct iw_point data; | ||
172 | char ssid[IW_ESSID_MAX_SIZE]; | ||
173 | |||
174 | int result; | ||
175 | int err = 0; | ||
176 | |||
177 | DBFENTER; | ||
178 | |||
179 | /* Get ESSID */ | ||
180 | result = p80211wext_giwessid(wlandev->netdev, NULL, &data, ssid); | ||
181 | |||
182 | if (result) { | ||
183 | err = -EFAULT; | ||
184 | goto exit; | ||
185 | } | ||
186 | |||
187 | if ( wlandev->hostwep & HOSTWEP_SHAREDKEY ) | ||
188 | msg.authtype.data = P80211ENUM_authalg_sharedkey; | ||
189 | else | ||
190 | msg.authtype.data = P80211ENUM_authalg_opensystem; | ||
191 | |||
192 | msg.msgcode = DIDmsg_lnxreq_autojoin; | ||
193 | |||
194 | /* Trim the last '\0' to fit the SSID format */ | ||
195 | |||
196 | if (data.length && ssid[data.length-1] == '\0') { | ||
197 | data.length = data.length - 1; | ||
198 | } | ||
199 | |||
200 | memcpy(msg.ssid.data.data, ssid, data.length); | ||
201 | msg.ssid.data.len = data.length; | ||
202 | |||
203 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
204 | |||
205 | if (result) { | ||
206 | err = -EFAULT; | ||
207 | goto exit; | ||
208 | } | ||
209 | |||
210 | exit: | ||
211 | |||
212 | DBFEXIT; | ||
213 | return err; | ||
214 | |||
215 | } | ||
216 | |||
217 | /* called by /proc/net/wireless */ | ||
218 | struct iw_statistics* p80211wext_get_wireless_stats (netdevice_t *dev) | ||
219 | { | ||
220 | p80211msg_lnxreq_commsquality_t quality; | ||
221 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
222 | struct iw_statistics* wstats = &wlandev->wstats; | ||
223 | int retval; | ||
224 | |||
225 | DBFENTER; | ||
226 | /* Check */ | ||
227 | if ( (wlandev == NULL) || (wlandev->msdstate != WLAN_MSD_RUNNING) ) | ||
228 | return NULL; | ||
229 | |||
230 | /* XXX Only valid in station mode */ | ||
231 | wstats->status = 0; | ||
232 | |||
233 | /* build request message */ | ||
234 | quality.msgcode = DIDmsg_lnxreq_commsquality; | ||
235 | quality.dbm.data = P80211ENUM_truth_true; | ||
236 | quality.dbm.status = P80211ENUM_msgitem_status_data_ok; | ||
237 | |||
238 | /* send message to nsd */ | ||
239 | if ( wlandev->mlmerequest == NULL ) | ||
240 | return NULL; | ||
241 | |||
242 | retval = wlandev->mlmerequest(wlandev, (p80211msg_t*) &quality); | ||
243 | |||
244 | wstats->qual.qual = qual_as_percent(quality.link.data); /* overall link quality */ | ||
245 | wstats->qual.level = quality.level.data; /* instant signal level */ | ||
246 | wstats->qual.noise = quality.noise.data; /* instant noise level */ | ||
247 | |||
248 | #if WIRELESS_EXT > 18 | ||
249 | wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM; | ||
250 | #else | ||
251 | wstats->qual.updated = 7; | ||
252 | #endif | ||
253 | wstats->discard.code = wlandev->rx.decrypt_err; | ||
254 | wstats->discard.nwid = 0; | ||
255 | wstats->discard.misc = 0; | ||
256 | |||
257 | #if WIRELESS_EXT > 11 | ||
258 | wstats->discard.fragment = 0; // incomplete fragments | ||
259 | wstats->discard.retries = 0; // tx retries. | ||
260 | wstats->miss.beacon = 0; | ||
261 | #endif | ||
262 | |||
263 | DBFEXIT; | ||
264 | |||
265 | return wstats; | ||
266 | } | ||
267 | |||
268 | static int p80211wext_giwname(netdevice_t *dev, | ||
269 | struct iw_request_info *info, | ||
270 | char *name, char *extra) | ||
271 | { | ||
272 | struct iw_param rate; | ||
273 | int result; | ||
274 | int err = 0; | ||
275 | |||
276 | DBFENTER; | ||
277 | |||
278 | result = p80211wext_giwrate(dev, NULL, &rate, NULL); | ||
279 | |||
280 | if (result) { | ||
281 | err = -EFAULT; | ||
282 | goto exit; | ||
283 | } | ||
284 | |||
285 | switch (rate.value) { | ||
286 | case 1000000: | ||
287 | case 2000000: | ||
288 | strcpy(name, "IEEE 802.11-DS"); | ||
289 | break; | ||
290 | case 5500000: | ||
291 | case 11000000: | ||
292 | strcpy(name, "IEEE 802.11-b"); | ||
293 | break; | ||
294 | } | ||
295 | exit: | ||
296 | DBFEXIT; | ||
297 | return err; | ||
298 | } | ||
299 | |||
300 | static int p80211wext_giwfreq(netdevice_t *dev, | ||
301 | struct iw_request_info *info, | ||
302 | struct iw_freq *freq, char *extra) | ||
303 | { | ||
304 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
305 | p80211item_uint32_t mibitem; | ||
306 | p80211msg_dot11req_mibset_t msg; | ||
307 | int result; | ||
308 | int err = 0; | ||
309 | |||
310 | DBFENTER; | ||
311 | |||
312 | msg.msgcode = DIDmsg_dot11req_mibget; | ||
313 | mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel; | ||
314 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
315 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
316 | |||
317 | if (result) { | ||
318 | err = -EFAULT; | ||
319 | goto exit; | ||
320 | } | ||
321 | |||
322 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
323 | |||
324 | if (mibitem.data > NUM_CHANNELS) { | ||
325 | err = -EFAULT; | ||
326 | goto exit; | ||
327 | } | ||
328 | |||
329 | /* convert into frequency instead of a channel */ | ||
330 | freq->e = 1; | ||
331 | freq->m = p80211_channel_to_mhz(mibitem.data, 0) * 100000; | ||
332 | |||
333 | exit: | ||
334 | DBFEXIT; | ||
335 | return err; | ||
336 | } | ||
337 | |||
338 | static int p80211wext_siwfreq(netdevice_t *dev, | ||
339 | struct iw_request_info *info, | ||
340 | struct iw_freq *freq, char *extra) | ||
341 | { | ||
342 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
343 | p80211item_uint32_t mibitem; | ||
344 | p80211msg_dot11req_mibset_t msg; | ||
345 | int result; | ||
346 | int err = 0; | ||
347 | |||
348 | DBFENTER; | ||
349 | |||
350 | if (!wlan_wext_write) { | ||
351 | err = (-EOPNOTSUPP); | ||
352 | goto exit; | ||
353 | } | ||
354 | |||
355 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
356 | mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel; | ||
357 | mibitem.status = P80211ENUM_msgitem_status_data_ok; | ||
358 | |||
359 | if ( (freq->e == 0) && (freq->m <= 1000) ) | ||
360 | mibitem.data = freq->m; | ||
361 | else | ||
362 | mibitem.data = p80211_mhz_to_channel(freq->m); | ||
363 | |||
364 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
365 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
366 | |||
367 | if (result) { | ||
368 | err = -EFAULT; | ||
369 | goto exit; | ||
370 | } | ||
371 | |||
372 | exit: | ||
373 | DBFEXIT; | ||
374 | return err; | ||
375 | } | ||
376 | |||
377 | #if WIRELESS_EXT > 8 | ||
378 | |||
379 | static int p80211wext_giwmode(netdevice_t *dev, | ||
380 | struct iw_request_info *info, | ||
381 | __u32 *mode, char *extra) | ||
382 | { | ||
383 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
384 | |||
385 | DBFENTER; | ||
386 | |||
387 | switch (wlandev->macmode) { | ||
388 | case WLAN_MACMODE_IBSS_STA: | ||
389 | *mode = IW_MODE_ADHOC; | ||
390 | break; | ||
391 | case WLAN_MACMODE_ESS_STA: | ||
392 | *mode = IW_MODE_INFRA; | ||
393 | break; | ||
394 | case WLAN_MACMODE_ESS_AP: | ||
395 | *mode = IW_MODE_MASTER; | ||
396 | break; | ||
397 | default: | ||
398 | /* Not set yet. */ | ||
399 | *mode = IW_MODE_AUTO; | ||
400 | } | ||
401 | |||
402 | DBFEXIT; | ||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | static int p80211wext_siwmode(netdevice_t *dev, | ||
407 | struct iw_request_info *info, | ||
408 | __u32 *mode, char *extra) | ||
409 | { | ||
410 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
411 | p80211item_uint32_t mibitem; | ||
412 | p80211msg_dot11req_mibset_t msg; | ||
413 | int result; | ||
414 | int err = 0; | ||
415 | |||
416 | DBFENTER; | ||
417 | |||
418 | if (!wlan_wext_write) { | ||
419 | err = (-EOPNOTSUPP); | ||
420 | goto exit; | ||
421 | } | ||
422 | |||
423 | if (*mode != IW_MODE_ADHOC && *mode != IW_MODE_INFRA && | ||
424 | *mode != IW_MODE_MASTER) { | ||
425 | err = (-EOPNOTSUPP); | ||
426 | goto exit; | ||
427 | } | ||
428 | |||
429 | /* Operation mode is the same with current mode */ | ||
430 | if (*mode == wlandev->macmode) | ||
431 | goto exit; | ||
432 | |||
433 | switch (*mode) { | ||
434 | case IW_MODE_ADHOC: | ||
435 | wlandev->macmode = WLAN_MACMODE_IBSS_STA; | ||
436 | break; | ||
437 | case IW_MODE_INFRA: | ||
438 | wlandev->macmode = WLAN_MACMODE_ESS_STA; | ||
439 | break; | ||
440 | case IW_MODE_MASTER: | ||
441 | wlandev->macmode = WLAN_MACMODE_ESS_AP; | ||
442 | break; | ||
443 | default: | ||
444 | /* Not set yet. */ | ||
445 | WLAN_LOG_INFO("Operation mode: %d not support\n", *mode); | ||
446 | return -EOPNOTSUPP; | ||
447 | } | ||
448 | |||
449 | /* Set Operation mode to the PORT TYPE RID */ | ||
450 | |||
451 | #warning "get rid of p2mib here" | ||
452 | |||
453 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
454 | mibitem.did = DIDmib_p2_p2Static_p2CnfPortType; | ||
455 | mibitem.data = (*mode == IW_MODE_ADHOC) ? 0 : 1; | ||
456 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
457 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
458 | |||
459 | if (result) | ||
460 | err = -EFAULT; | ||
461 | |||
462 | exit: | ||
463 | DBFEXIT; | ||
464 | |||
465 | return err; | ||
466 | } | ||
467 | |||
468 | |||
469 | static int p80211wext_giwrange(netdevice_t *dev, | ||
470 | struct iw_request_info *info, | ||
471 | struct iw_point *data, char *extra) | ||
472 | { | ||
473 | struct iw_range *range = (struct iw_range *) extra; | ||
474 | int i, val; | ||
475 | |||
476 | DBFENTER; | ||
477 | |||
478 | // for backward compatability set size & zero everything we don't understand | ||
479 | data->length = sizeof(*range); | ||
480 | memset(range,0,sizeof(*range)); | ||
481 | |||
482 | #if WIRELESS_EXT > 9 | ||
483 | range->txpower_capa = IW_TXPOW_DBM; | ||
484 | // XXX what about min/max_pmp, min/max_pmt, etc. | ||
485 | #endif | ||
486 | |||
487 | #if WIRELESS_EXT > 10 | ||
488 | range->we_version_compiled = WIRELESS_EXT; | ||
489 | range->we_version_source = 13; | ||
490 | |||
491 | range->retry_capa = IW_RETRY_LIMIT; | ||
492 | range->retry_flags = IW_RETRY_LIMIT; | ||
493 | range->min_retry = 0; | ||
494 | range->max_retry = 255; | ||
495 | #endif /* WIRELESS_EXT > 10 */ | ||
496 | |||
497 | #if WIRELESS_EXT > 16 | ||
498 | range->event_capa[0] = (IW_EVENT_CAPA_K_0 | //mode/freq/ssid | ||
499 | IW_EVENT_CAPA_MASK(SIOCGIWAP) | | ||
500 | IW_EVENT_CAPA_MASK(SIOCGIWSCAN)); | ||
501 | range->event_capa[1] = IW_EVENT_CAPA_K_1; //encode | ||
502 | range->event_capa[4] = (IW_EVENT_CAPA_MASK(IWEVQUAL) | | ||
503 | IW_EVENT_CAPA_MASK(IWEVCUSTOM) ); | ||
504 | #endif | ||
505 | |||
506 | range->num_channels = NUM_CHANNELS; | ||
507 | |||
508 | /* XXX need to filter against the regulatory domain &| active set */ | ||
509 | val = 0; | ||
510 | for (i = 0; i < NUM_CHANNELS ; i++) { | ||
511 | range->freq[val].i = i + 1; | ||
512 | range->freq[val].m = p80211wext_channel_freq[i] * 100000; | ||
513 | range->freq[val].e = 1; | ||
514 | val++; | ||
515 | } | ||
516 | |||
517 | range->num_frequency = val; | ||
518 | |||
519 | /* Max of /proc/net/wireless */ | ||
520 | range->max_qual.qual = 100; | ||
521 | range->max_qual.level = 0; | ||
522 | range->max_qual.noise = 0; | ||
523 | range->sensitivity = 3; | ||
524 | // XXX these need to be nsd-specific! | ||
525 | |||
526 | range->min_rts = 0; | ||
527 | range->max_rts = 2347; | ||
528 | range->min_frag = 256; | ||
529 | range->max_frag = 2346; | ||
530 | |||
531 | range->max_encoding_tokens = NUM_WEPKEYS; | ||
532 | range->num_encoding_sizes = 2; | ||
533 | range->encoding_size[0] = 5; | ||
534 | range->encoding_size[1] = 13; | ||
535 | |||
536 | // XXX what about num_bitrates/throughput? | ||
537 | range->num_bitrates = 0; | ||
538 | |||
539 | /* estimated max throughput */ | ||
540 | // XXX need to cap it if we're running at ~2Mbps.. | ||
541 | range->throughput = 5500000; | ||
542 | |||
543 | DBFEXIT; | ||
544 | return 0; | ||
545 | } | ||
546 | #endif | ||
547 | |||
548 | static int p80211wext_giwap(netdevice_t *dev, | ||
549 | struct iw_request_info *info, | ||
550 | struct sockaddr *ap_addr, char *extra) | ||
551 | { | ||
552 | |||
553 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
554 | |||
555 | DBFENTER; | ||
556 | |||
557 | memcpy(ap_addr->sa_data, wlandev->bssid, WLAN_BSSID_LEN); | ||
558 | ap_addr->sa_family = ARPHRD_ETHER; | ||
559 | |||
560 | DBFEXIT; | ||
561 | return 0; | ||
562 | } | ||
563 | |||
564 | #if WIRELESS_EXT > 8 | ||
565 | static int p80211wext_giwencode(netdevice_t *dev, | ||
566 | struct iw_request_info *info, | ||
567 | struct iw_point *erq, char *key) | ||
568 | { | ||
569 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
570 | int err = 0; | ||
571 | int i; | ||
572 | |||
573 | DBFENTER; | ||
574 | |||
575 | if (wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) | ||
576 | erq->flags = IW_ENCODE_ENABLED; | ||
577 | else | ||
578 | erq->flags = IW_ENCODE_DISABLED; | ||
579 | |||
580 | if (wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) | ||
581 | erq->flags |= IW_ENCODE_RESTRICTED; | ||
582 | else | ||
583 | erq->flags |= IW_ENCODE_OPEN; | ||
584 | |||
585 | i = (erq->flags & IW_ENCODE_INDEX) - 1; | ||
586 | |||
587 | if (i == -1) | ||
588 | i = wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK; | ||
589 | |||
590 | if ((i < 0) || (i >= NUM_WEPKEYS)) { | ||
591 | err = -EINVAL; | ||
592 | goto exit; | ||
593 | } | ||
594 | |||
595 | erq->flags |= i + 1; | ||
596 | |||
597 | /* copy the key from the driver cache as the keys are read-only MIBs */ | ||
598 | erq->length = wlandev->wep_keylens[i]; | ||
599 | memcpy(key, wlandev->wep_keys[i], erq->length); | ||
600 | |||
601 | exit: | ||
602 | DBFEXIT; | ||
603 | return err; | ||
604 | } | ||
605 | |||
606 | static int p80211wext_siwencode(netdevice_t *dev, | ||
607 | struct iw_request_info *info, | ||
608 | struct iw_point *erq, char *key) | ||
609 | { | ||
610 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
611 | p80211msg_dot11req_mibset_t msg; | ||
612 | p80211item_pstr32_t pstr; | ||
613 | |||
614 | int err = 0; | ||
615 | int result = 0; | ||
616 | int enable = 0; | ||
617 | int i; | ||
618 | |||
619 | DBFENTER; | ||
620 | if (!wlan_wext_write) { | ||
621 | err = (-EOPNOTSUPP); | ||
622 | goto exit; | ||
623 | } | ||
624 | |||
625 | /* Check the Key index first. */ | ||
626 | if((i = (erq->flags & IW_ENCODE_INDEX))) { | ||
627 | |||
628 | if ((i < 1) || (i > NUM_WEPKEYS)) { | ||
629 | err = -EINVAL; | ||
630 | goto exit; | ||
631 | } | ||
632 | else | ||
633 | i--; | ||
634 | |||
635 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, i); | ||
636 | |||
637 | if (result) { | ||
638 | err = -EFAULT; | ||
639 | goto exit; | ||
640 | } | ||
641 | else { | ||
642 | enable = 1; | ||
643 | } | ||
644 | |||
645 | } | ||
646 | else { | ||
647 | // Do not thing when no Key Index | ||
648 | } | ||
649 | |||
650 | /* Check if there is no key information in the iwconfig request */ | ||
651 | if((erq->flags & IW_ENCODE_NOKEY) == 0 && enable == 1) { | ||
652 | |||
653 | /*------------------------------------------------------------ | ||
654 | * If there is WEP Key for setting, check the Key Information | ||
655 | * and then set it to the firmware. | ||
656 | -------------------------------------------------------------*/ | ||
657 | |||
658 | if (erq->length > 0) { | ||
659 | |||
660 | /* copy the key from the driver cache as the keys are read-only MIBs */ | ||
661 | wlandev->wep_keylens[i] = erq->length; | ||
662 | memcpy(wlandev->wep_keys[i], key, erq->length); | ||
663 | |||
664 | /* Prepare data struture for p80211req_dorequest. */ | ||
665 | memcpy(pstr.data.data, key, erq->length); | ||
666 | pstr.data.len = erq->length; | ||
667 | |||
668 | switch(i) | ||
669 | { | ||
670 | case 0: | ||
671 | pstr.did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0; | ||
672 | break; | ||
673 | |||
674 | case 1: | ||
675 | pstr.did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1; | ||
676 | break; | ||
677 | |||
678 | case 2: | ||
679 | pstr.did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2; | ||
680 | break; | ||
681 | |||
682 | case 3: | ||
683 | pstr.did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3; | ||
684 | break; | ||
685 | |||
686 | default: | ||
687 | err = -EINVAL; | ||
688 | goto exit; | ||
689 | } | ||
690 | |||
691 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
692 | memcpy(&msg.mibattribute.data, &pstr, sizeof(pstr)); | ||
693 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
694 | |||
695 | if (result) { | ||
696 | err = -EFAULT; | ||
697 | goto exit; | ||
698 | } | ||
699 | } | ||
700 | |||
701 | } | ||
702 | |||
703 | /* Check the PrivacyInvoked flag */ | ||
704 | if (erq->flags & IW_ENCODE_DISABLED) { | ||
705 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, P80211ENUM_truth_false); | ||
706 | } | ||
707 | else if((erq->flags & IW_ENCODE_ENABLED) || enable == 1) { | ||
708 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, P80211ENUM_truth_true); | ||
709 | } | ||
710 | |||
711 | if (result) { | ||
712 | err = -EFAULT; | ||
713 | goto exit; | ||
714 | } | ||
715 | |||
716 | /* Check the ExcludeUnencrypted flag */ | ||
717 | if (erq->flags & IW_ENCODE_RESTRICTED) { | ||
718 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, P80211ENUM_truth_true); | ||
719 | } | ||
720 | else if (erq->flags & IW_ENCODE_OPEN) { | ||
721 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, P80211ENUM_truth_false); | ||
722 | } | ||
723 | |||
724 | if (result) { | ||
725 | err = -EFAULT; | ||
726 | goto exit; | ||
727 | } | ||
728 | |||
729 | exit: | ||
730 | |||
731 | DBFEXIT; | ||
732 | return err; | ||
733 | } | ||
734 | |||
735 | static int p80211wext_giwessid(netdevice_t *dev, | ||
736 | struct iw_request_info *info, | ||
737 | struct iw_point *data, char *essid) | ||
738 | { | ||
739 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
740 | |||
741 | DBFENTER; | ||
742 | |||
743 | if (wlandev->ssid.len) { | ||
744 | data->length = wlandev->ssid.len; | ||
745 | data->flags = 1; | ||
746 | memcpy(essid, wlandev->ssid.data, data->length); | ||
747 | essid[data->length] = 0; | ||
748 | #if (WIRELESS_EXT < 21) | ||
749 | data->length++; | ||
750 | #endif | ||
751 | } else { | ||
752 | memset(essid, 0, sizeof(wlandev->ssid.data)); | ||
753 | data->length = 0; | ||
754 | data->flags = 0; | ||
755 | } | ||
756 | |||
757 | DBFEXIT; | ||
758 | return 0; | ||
759 | } | ||
760 | |||
761 | static int p80211wext_siwessid(netdevice_t *dev, | ||
762 | struct iw_request_info *info, | ||
763 | struct iw_point *data, char *essid) | ||
764 | { | ||
765 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
766 | p80211msg_lnxreq_autojoin_t msg; | ||
767 | |||
768 | int result; | ||
769 | int err = 0; | ||
770 | int length = data->length; | ||
771 | |||
772 | DBFENTER; | ||
773 | |||
774 | if (!wlan_wext_write) { | ||
775 | err = (-EOPNOTSUPP); | ||
776 | goto exit; | ||
777 | } | ||
778 | |||
779 | |||
780 | if ( wlandev->hostwep & HOSTWEP_SHAREDKEY ) | ||
781 | msg.authtype.data = P80211ENUM_authalg_sharedkey; | ||
782 | else | ||
783 | msg.authtype.data = P80211ENUM_authalg_opensystem; | ||
784 | |||
785 | msg.msgcode = DIDmsg_lnxreq_autojoin; | ||
786 | |||
787 | #if (WIRELESS_EXT < 21) | ||
788 | if (length) length--; | ||
789 | #endif | ||
790 | |||
791 | /* Trim the last '\0' to fit the SSID format */ | ||
792 | |||
793 | if (length && essid[length-1] == '\0') { | ||
794 | length--; | ||
795 | } | ||
796 | |||
797 | memcpy(msg.ssid.data.data, essid, length); | ||
798 | msg.ssid.data.len = length; | ||
799 | |||
800 | WLAN_LOG_DEBUG(1,"autojoin_ssid for %s \n",essid); | ||
801 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
802 | WLAN_LOG_DEBUG(1,"autojoin_ssid %d\n",result); | ||
803 | |||
804 | if (result) { | ||
805 | err = -EFAULT; | ||
806 | goto exit; | ||
807 | } | ||
808 | |||
809 | exit: | ||
810 | DBFEXIT; | ||
811 | return err; | ||
812 | } | ||
813 | |||
814 | |||
815 | static int p80211wext_siwcommit(netdevice_t *dev, | ||
816 | struct iw_request_info *info, | ||
817 | struct iw_point *data, char *essid) | ||
818 | { | ||
819 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
820 | int err = 0; | ||
821 | |||
822 | DBFENTER; | ||
823 | |||
824 | if (!wlan_wext_write) { | ||
825 | err = (-EOPNOTSUPP); | ||
826 | goto exit; | ||
827 | } | ||
828 | |||
829 | /* Auto Join */ | ||
830 | err = p80211wext_autojoin(wlandev); | ||
831 | |||
832 | exit: | ||
833 | DBFEXIT; | ||
834 | return err; | ||
835 | } | ||
836 | |||
837 | |||
838 | static int p80211wext_giwrate(netdevice_t *dev, | ||
839 | struct iw_request_info *info, | ||
840 | struct iw_param *rrq, char *extra) | ||
841 | { | ||
842 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
843 | p80211item_uint32_t mibitem; | ||
844 | p80211msg_dot11req_mibset_t msg; | ||
845 | int result; | ||
846 | int err = 0; | ||
847 | |||
848 | DBFENTER; | ||
849 | |||
850 | msg.msgcode = DIDmsg_dot11req_mibget; | ||
851 | mibitem.did = DIDmib_p2_p2MAC_p2CurrentTxRate; | ||
852 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
853 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
854 | |||
855 | if (result) { | ||
856 | err = -EFAULT; | ||
857 | goto exit; | ||
858 | } | ||
859 | |||
860 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
861 | |||
862 | rrq->fixed = 0; /* can it change? */ | ||
863 | rrq->disabled = 0; | ||
864 | rrq->value = 0; | ||
865 | |||
866 | #define HFA384x_RATEBIT_1 ((UINT16)1) | ||
867 | #define HFA384x_RATEBIT_2 ((UINT16)2) | ||
868 | #define HFA384x_RATEBIT_5dot5 ((UINT16)4) | ||
869 | #define HFA384x_RATEBIT_11 ((UINT16)8) | ||
870 | |||
871 | switch (mibitem.data) { | ||
872 | case HFA384x_RATEBIT_1: | ||
873 | rrq->value = 1000000; | ||
874 | break; | ||
875 | case HFA384x_RATEBIT_2: | ||
876 | rrq->value = 2000000; | ||
877 | break; | ||
878 | case HFA384x_RATEBIT_5dot5: | ||
879 | rrq->value = 5500000; | ||
880 | break; | ||
881 | case HFA384x_RATEBIT_11: | ||
882 | rrq->value = 11000000; | ||
883 | break; | ||
884 | default: | ||
885 | err = -EINVAL; | ||
886 | } | ||
887 | exit: | ||
888 | DBFEXIT; | ||
889 | return err; | ||
890 | } | ||
891 | |||
892 | static int p80211wext_giwrts(netdevice_t *dev, | ||
893 | struct iw_request_info *info, | ||
894 | struct iw_param *rts, char *extra) | ||
895 | { | ||
896 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
897 | p80211item_uint32_t mibitem; | ||
898 | p80211msg_dot11req_mibset_t msg; | ||
899 | int result; | ||
900 | int err = 0; | ||
901 | |||
902 | DBFENTER; | ||
903 | |||
904 | msg.msgcode = DIDmsg_dot11req_mibget; | ||
905 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold; | ||
906 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
907 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
908 | |||
909 | if (result) { | ||
910 | err = -EFAULT; | ||
911 | goto exit; | ||
912 | } | ||
913 | |||
914 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
915 | |||
916 | rts->value = mibitem.data; | ||
917 | rts->disabled = (rts->value == 2347); | ||
918 | rts->fixed = 1; | ||
919 | |||
920 | exit: | ||
921 | DBFEXIT; | ||
922 | return err; | ||
923 | } | ||
924 | |||
925 | |||
926 | static int p80211wext_siwrts(netdevice_t *dev, | ||
927 | struct iw_request_info *info, | ||
928 | struct iw_param *rts, char *extra) | ||
929 | { | ||
930 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
931 | p80211item_uint32_t mibitem; | ||
932 | p80211msg_dot11req_mibset_t msg; | ||
933 | int result; | ||
934 | int err = 0; | ||
935 | |||
936 | DBFENTER; | ||
937 | |||
938 | if (!wlan_wext_write) { | ||
939 | err = (-EOPNOTSUPP); | ||
940 | goto exit; | ||
941 | } | ||
942 | |||
943 | msg.msgcode = DIDmsg_dot11req_mibget; | ||
944 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold; | ||
945 | if (rts->disabled) | ||
946 | mibitem.data = 2347; | ||
947 | else | ||
948 | mibitem.data = rts->value; | ||
949 | |||
950 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
951 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
952 | |||
953 | if (result) { | ||
954 | err = -EFAULT; | ||
955 | goto exit; | ||
956 | } | ||
957 | |||
958 | exit: | ||
959 | DBFEXIT; | ||
960 | return err; | ||
961 | } | ||
962 | |||
963 | static int p80211wext_giwfrag(netdevice_t *dev, | ||
964 | struct iw_request_info *info, | ||
965 | struct iw_param *frag, char *extra) | ||
966 | { | ||
967 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
968 | p80211item_uint32_t mibitem; | ||
969 | p80211msg_dot11req_mibset_t msg; | ||
970 | int result; | ||
971 | int err = 0; | ||
972 | |||
973 | DBFENTER; | ||
974 | |||
975 | msg.msgcode = DIDmsg_dot11req_mibget; | ||
976 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold; | ||
977 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
978 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
979 | |||
980 | if (result) { | ||
981 | err = -EFAULT; | ||
982 | goto exit; | ||
983 | } | ||
984 | |||
985 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
986 | |||
987 | frag->value = mibitem.data; | ||
988 | frag->disabled = (frag->value == 2346); | ||
989 | frag->fixed = 1; | ||
990 | |||
991 | exit: | ||
992 | DBFEXIT; | ||
993 | return err; | ||
994 | } | ||
995 | |||
996 | static int p80211wext_siwfrag(netdevice_t *dev, | ||
997 | struct iw_request_info *info, | ||
998 | struct iw_param *frag, char *extra) | ||
999 | { | ||
1000 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1001 | p80211item_uint32_t mibitem; | ||
1002 | p80211msg_dot11req_mibset_t msg; | ||
1003 | int result; | ||
1004 | int err = 0; | ||
1005 | |||
1006 | DBFENTER; | ||
1007 | |||
1008 | if (!wlan_wext_write) { | ||
1009 | err = (-EOPNOTSUPP); | ||
1010 | goto exit; | ||
1011 | } | ||
1012 | |||
1013 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
1014 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold; | ||
1015 | |||
1016 | if (frag->disabled) | ||
1017 | mibitem.data = 2346; | ||
1018 | else | ||
1019 | mibitem.data = frag->value; | ||
1020 | |||
1021 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1022 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1023 | |||
1024 | if (result) { | ||
1025 | err = -EFAULT; | ||
1026 | goto exit; | ||
1027 | } | ||
1028 | |||
1029 | exit: | ||
1030 | DBFEXIT; | ||
1031 | return err; | ||
1032 | } | ||
1033 | |||
1034 | #endif /* WIRELESS_EXT > 8 */ | ||
1035 | |||
1036 | #if WIRELESS_EXT > 10 | ||
1037 | |||
1038 | #ifndef IW_RETRY_LONG | ||
1039 | #define IW_RETRY_LONG IW_RETRY_MAX | ||
1040 | #endif | ||
1041 | |||
1042 | #ifndef IW_RETRY_SHORT | ||
1043 | #define IW_RETRY_SHORT IW_RETRY_MIN | ||
1044 | #endif | ||
1045 | |||
1046 | static int p80211wext_giwretry(netdevice_t *dev, | ||
1047 | struct iw_request_info *info, | ||
1048 | struct iw_param *rrq, char *extra) | ||
1049 | { | ||
1050 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1051 | p80211item_uint32_t mibitem; | ||
1052 | p80211msg_dot11req_mibset_t msg; | ||
1053 | int result; | ||
1054 | int err = 0; | ||
1055 | UINT16 shortretry, longretry, lifetime; | ||
1056 | |||
1057 | DBFENTER; | ||
1058 | |||
1059 | msg.msgcode = DIDmsg_dot11req_mibget; | ||
1060 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit; | ||
1061 | |||
1062 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1063 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1064 | |||
1065 | if (result) { | ||
1066 | err = -EFAULT; | ||
1067 | goto exit; | ||
1068 | } | ||
1069 | |||
1070 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
1071 | |||
1072 | shortretry = mibitem.data; | ||
1073 | |||
1074 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit; | ||
1075 | |||
1076 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1077 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1078 | |||
1079 | if (result) { | ||
1080 | err = -EFAULT; | ||
1081 | goto exit; | ||
1082 | } | ||
1083 | |||
1084 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
1085 | |||
1086 | longretry = mibitem.data; | ||
1087 | |||
1088 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime; | ||
1089 | |||
1090 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1091 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1092 | |||
1093 | if (result) { | ||
1094 | err = -EFAULT; | ||
1095 | goto exit; | ||
1096 | } | ||
1097 | |||
1098 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
1099 | |||
1100 | lifetime = mibitem.data; | ||
1101 | |||
1102 | rrq->disabled = 0; | ||
1103 | |||
1104 | if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | ||
1105 | rrq->flags = IW_RETRY_LIFETIME; | ||
1106 | rrq->value = lifetime * 1024; | ||
1107 | } else { | ||
1108 | if (rrq->flags & IW_RETRY_LONG) { | ||
1109 | rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; | ||
1110 | rrq->value = longretry; | ||
1111 | } else { | ||
1112 | rrq->flags = IW_RETRY_LIMIT; | ||
1113 | rrq->value = shortretry; | ||
1114 | if (shortretry != longretry) | ||
1115 | rrq->flags |= IW_RETRY_SHORT; | ||
1116 | } | ||
1117 | } | ||
1118 | |||
1119 | exit: | ||
1120 | DBFEXIT; | ||
1121 | return err; | ||
1122 | |||
1123 | } | ||
1124 | |||
1125 | static int p80211wext_siwretry(netdevice_t *dev, | ||
1126 | struct iw_request_info *info, | ||
1127 | struct iw_param *rrq, char *extra) | ||
1128 | { | ||
1129 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1130 | p80211item_uint32_t mibitem; | ||
1131 | p80211msg_dot11req_mibset_t msg; | ||
1132 | int result; | ||
1133 | int err = 0; | ||
1134 | |||
1135 | DBFENTER; | ||
1136 | |||
1137 | if (!wlan_wext_write) { | ||
1138 | err = (-EOPNOTSUPP); | ||
1139 | goto exit; | ||
1140 | } | ||
1141 | |||
1142 | if (rrq->disabled) { | ||
1143 | err = -EINVAL; | ||
1144 | goto exit; | ||
1145 | } | ||
1146 | |||
1147 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
1148 | |||
1149 | if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { | ||
1150 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime; | ||
1151 | mibitem.data = rrq->value /= 1024; | ||
1152 | |||
1153 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1154 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1155 | |||
1156 | if (result) { | ||
1157 | err = -EFAULT; | ||
1158 | goto exit; | ||
1159 | } | ||
1160 | } else { | ||
1161 | if (rrq->flags & IW_RETRY_LONG) { | ||
1162 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit; | ||
1163 | mibitem.data = rrq->value; | ||
1164 | |||
1165 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1166 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1167 | |||
1168 | if (result) { | ||
1169 | err = -EFAULT; | ||
1170 | goto exit; | ||
1171 | } | ||
1172 | } | ||
1173 | |||
1174 | if (rrq->flags & IW_RETRY_SHORT) { | ||
1175 | mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit; | ||
1176 | mibitem.data = rrq->value; | ||
1177 | |||
1178 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1179 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1180 | |||
1181 | if (result) { | ||
1182 | err = -EFAULT; | ||
1183 | goto exit; | ||
1184 | } | ||
1185 | } | ||
1186 | } | ||
1187 | |||
1188 | exit: | ||
1189 | DBFEXIT; | ||
1190 | return err; | ||
1191 | |||
1192 | } | ||
1193 | |||
1194 | #endif /* WIRELESS_EXT > 10 */ | ||
1195 | |||
1196 | #if WIRELESS_EXT > 9 | ||
1197 | static int p80211wext_siwtxpow(netdevice_t *dev, | ||
1198 | struct iw_request_info *info, | ||
1199 | struct iw_param *rrq, char *extra) | ||
1200 | { | ||
1201 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1202 | p80211item_uint32_t mibitem; | ||
1203 | p80211msg_dot11req_mibset_t msg; | ||
1204 | int result; | ||
1205 | int err = 0; | ||
1206 | |||
1207 | DBFENTER; | ||
1208 | |||
1209 | if (!wlan_wext_write) { | ||
1210 | err = (-EOPNOTSUPP); | ||
1211 | goto exit; | ||
1212 | } | ||
1213 | |||
1214 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
1215 | |||
1216 | switch (rrq->value) { | ||
1217 | |||
1218 | case 1 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1; break; | ||
1219 | case 2 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2; break; | ||
1220 | case 3 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3; break; | ||
1221 | case 4 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4; break; | ||
1222 | case 5 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5; break; | ||
1223 | case 6 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6; break; | ||
1224 | case 7 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7; break; | ||
1225 | case 8 : mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8; break; | ||
1226 | default: mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8; break; | ||
1227 | } | ||
1228 | |||
1229 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1230 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1231 | |||
1232 | if (result) { | ||
1233 | err = -EFAULT; | ||
1234 | goto exit; | ||
1235 | } | ||
1236 | |||
1237 | exit: | ||
1238 | DBFEXIT; | ||
1239 | return err; | ||
1240 | } | ||
1241 | |||
1242 | static int p80211wext_giwtxpow(netdevice_t *dev, | ||
1243 | struct iw_request_info *info, | ||
1244 | struct iw_param *rrq, char *extra) | ||
1245 | { | ||
1246 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1247 | p80211item_uint32_t mibitem; | ||
1248 | p80211msg_dot11req_mibset_t msg; | ||
1249 | int result; | ||
1250 | int err = 0; | ||
1251 | |||
1252 | DBFENTER; | ||
1253 | |||
1254 | msg.msgcode = DIDmsg_dot11req_mibget; | ||
1255 | mibitem.did = DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel; | ||
1256 | |||
1257 | memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); | ||
1258 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1259 | |||
1260 | if (result) { | ||
1261 | err = -EFAULT; | ||
1262 | goto exit; | ||
1263 | } | ||
1264 | |||
1265 | memcpy(&mibitem, &msg.mibattribute.data, sizeof(mibitem)); | ||
1266 | |||
1267 | // XXX handle OFF by setting disabled = 1; | ||
1268 | |||
1269 | rrq->flags = 0; // IW_TXPOW_DBM; | ||
1270 | rrq->disabled = 0; | ||
1271 | rrq->fixed = 0; | ||
1272 | rrq->value = mibitem.data; | ||
1273 | |||
1274 | exit: | ||
1275 | DBFEXIT; | ||
1276 | return err; | ||
1277 | } | ||
1278 | #endif /* WIRELESS_EXT > 9 */ | ||
1279 | |||
1280 | static int p80211wext_siwspy(netdevice_t *dev, | ||
1281 | struct iw_request_info *info, | ||
1282 | struct iw_point *srq, char *extra) | ||
1283 | { | ||
1284 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1285 | struct sockaddr address[IW_MAX_SPY]; | ||
1286 | int number = srq->length; | ||
1287 | int i; | ||
1288 | |||
1289 | DBFENTER; | ||
1290 | |||
1291 | /* Copy the data from the input buffer */ | ||
1292 | memcpy(address, extra, sizeof(struct sockaddr)*number); | ||
1293 | |||
1294 | wlandev->spy_number = 0; | ||
1295 | |||
1296 | if (number > 0) { | ||
1297 | |||
1298 | /* extract the addresses */ | ||
1299 | for (i = 0; i < number; i++) { | ||
1300 | |||
1301 | memcpy(wlandev->spy_address[i], address[i].sa_data, ETH_ALEN); | ||
1302 | } | ||
1303 | |||
1304 | /* reset stats */ | ||
1305 | memset(wlandev->spy_stat, 0, sizeof(struct iw_quality) * IW_MAX_SPY); | ||
1306 | |||
1307 | /* set number of addresses */ | ||
1308 | wlandev->spy_number = number; | ||
1309 | } | ||
1310 | |||
1311 | DBFEXIT; | ||
1312 | return 0; | ||
1313 | } | ||
1314 | |||
1315 | /* jkriegl: from orinoco, modified */ | ||
1316 | static int p80211wext_giwspy(netdevice_t *dev, | ||
1317 | struct iw_request_info *info, | ||
1318 | struct iw_point *srq, char *extra) | ||
1319 | { | ||
1320 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1321 | |||
1322 | struct sockaddr address[IW_MAX_SPY]; | ||
1323 | struct iw_quality spy_stat[IW_MAX_SPY]; | ||
1324 | int number; | ||
1325 | int i; | ||
1326 | |||
1327 | DBFENTER; | ||
1328 | |||
1329 | number = wlandev->spy_number; | ||
1330 | |||
1331 | if (number > 0) { | ||
1332 | |||
1333 | /* populate address and spy struct's */ | ||
1334 | for (i = 0; i < number; i++) { | ||
1335 | memcpy(address[i].sa_data, wlandev->spy_address[i], ETH_ALEN); | ||
1336 | address[i].sa_family = AF_UNIX; | ||
1337 | memcpy(&spy_stat[i], &wlandev->spy_stat[i], sizeof(struct iw_quality)); | ||
1338 | } | ||
1339 | |||
1340 | /* reset update flag */ | ||
1341 | for (i=0; i < number; i++) | ||
1342 | wlandev->spy_stat[i].updated = 0; | ||
1343 | } | ||
1344 | |||
1345 | /* push stuff to user space */ | ||
1346 | srq->length = number; | ||
1347 | memcpy(extra, address, sizeof(struct sockaddr)*number); | ||
1348 | memcpy(extra+sizeof(struct sockaddr)*number, spy_stat, sizeof(struct iw_quality)*number); | ||
1349 | |||
1350 | DBFEXIT; | ||
1351 | return 0; | ||
1352 | } | ||
1353 | |||
1354 | static int prism2_result2err (int prism2_result) | ||
1355 | { | ||
1356 | int err = 0; | ||
1357 | |||
1358 | switch (prism2_result) { | ||
1359 | case P80211ENUM_resultcode_invalid_parameters: | ||
1360 | err = -EINVAL; | ||
1361 | break; | ||
1362 | case P80211ENUM_resultcode_implementation_failure: | ||
1363 | err = -EIO; | ||
1364 | break; | ||
1365 | case P80211ENUM_resultcode_not_supported: | ||
1366 | err = -EOPNOTSUPP; | ||
1367 | break; | ||
1368 | default: | ||
1369 | err = 0; | ||
1370 | break; | ||
1371 | } | ||
1372 | |||
1373 | return err; | ||
1374 | } | ||
1375 | |||
1376 | #if WIRELESS_EXT > 13 | ||
1377 | static int p80211wext_siwscan(netdevice_t *dev, | ||
1378 | struct iw_request_info *info, | ||
1379 | struct iw_point *srq, char *extra) | ||
1380 | { | ||
1381 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1382 | p80211msg_dot11req_scan_t msg; | ||
1383 | int result; | ||
1384 | int err = 0; | ||
1385 | int i = 0; | ||
1386 | |||
1387 | DBFENTER; | ||
1388 | |||
1389 | if (wlandev->macmode == WLAN_MACMODE_ESS_AP) { | ||
1390 | WLAN_LOG_ERROR("Can't scan in AP mode\n"); | ||
1391 | err = (-EOPNOTSUPP); | ||
1392 | goto exit; | ||
1393 | } | ||
1394 | |||
1395 | memset(&msg, 0x00, sizeof(p80211msg_dot11req_scan_t)); | ||
1396 | msg.msgcode = DIDmsg_dot11req_scan; | ||
1397 | msg.bsstype.data = P80211ENUM_bsstype_any; | ||
1398 | |||
1399 | memset(&(msg.bssid.data), 0xFF, sizeof (p80211item_pstr6_t)); | ||
1400 | msg.bssid.data.len = 6; | ||
1401 | |||
1402 | msg.scantype.data = P80211ENUM_scantype_active; | ||
1403 | msg.probedelay.data = 0; | ||
1404 | |||
1405 | for (i = 1; i <= 14; i++) | ||
1406 | msg.channellist.data.data[i-1] = i; | ||
1407 | msg.channellist.data.len = 14; | ||
1408 | |||
1409 | msg.maxchanneltime.data = 250; | ||
1410 | msg.minchanneltime.data = 200; | ||
1411 | |||
1412 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1413 | if (result) | ||
1414 | err = prism2_result2err (msg.resultcode.data); | ||
1415 | |||
1416 | exit: | ||
1417 | DBFEXIT; | ||
1418 | return err; | ||
1419 | } | ||
1420 | |||
1421 | |||
1422 | /* Helper to translate scan into Wireless Extensions scan results. | ||
1423 | * Inspired by the prism54 code, which was in turn inspired by the | ||
1424 | * airo driver code. | ||
1425 | */ | ||
1426 | static char * | ||
1427 | wext_translate_bss(struct iw_request_info *info, char *current_ev, | ||
1428 | char *end_buf, p80211msg_dot11req_scan_results_t *bss) | ||
1429 | { | ||
1430 | struct iw_event iwe; /* Temporary buffer */ | ||
1431 | |||
1432 | /* The first entry must be the MAC address */ | ||
1433 | memcpy(iwe.u.ap_addr.sa_data, bss->bssid.data.data, WLAN_BSSID_LEN); | ||
1434 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | ||
1435 | iwe.cmd = SIOCGIWAP; | ||
1436 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN); | ||
1437 | |||
1438 | /* The following entries will be displayed in the same order we give them */ | ||
1439 | |||
1440 | /* The ESSID. */ | ||
1441 | if (bss->ssid.data.len > 0) { | ||
1442 | char essid[IW_ESSID_MAX_SIZE + 1]; | ||
1443 | int size; | ||
1444 | |||
1445 | size = wlan_min(IW_ESSID_MAX_SIZE, bss->ssid.data.len); | ||
1446 | memset(&essid, 0, sizeof (essid)); | ||
1447 | memcpy(&essid, bss->ssid.data.data, size); | ||
1448 | WLAN_LOG_DEBUG(1, " essid size = %d\n", size); | ||
1449 | iwe.u.data.length = size; | ||
1450 | iwe.u.data.flags = 1; | ||
1451 | iwe.cmd = SIOCGIWESSID; | ||
1452 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, &essid[0]); | ||
1453 | WLAN_LOG_DEBUG(1, " essid size OK.\n"); | ||
1454 | } | ||
1455 | |||
1456 | switch (bss->bsstype.data) { | ||
1457 | case P80211ENUM_bsstype_infrastructure: | ||
1458 | iwe.u.mode = IW_MODE_MASTER; | ||
1459 | break; | ||
1460 | |||
1461 | case P80211ENUM_bsstype_independent: | ||
1462 | iwe.u.mode = IW_MODE_ADHOC; | ||
1463 | break; | ||
1464 | |||
1465 | default: | ||
1466 | iwe.u.mode = 0; | ||
1467 | break; | ||
1468 | } | ||
1469 | iwe.cmd = SIOCGIWMODE; | ||
1470 | if (iwe.u.mode) | ||
1471 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN); | ||
1472 | |||
1473 | /* Encryption capability */ | ||
1474 | if (bss->privacy.data == P80211ENUM_truth_true) | ||
1475 | iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; | ||
1476 | else | ||
1477 | iwe.u.data.flags = IW_ENCODE_DISABLED; | ||
1478 | iwe.u.data.length = 0; | ||
1479 | iwe.cmd = SIOCGIWENCODE; | ||
1480 | current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, NULL); | ||
1481 | |||
1482 | /* Add frequency. (short) bss->channel is the frequency in MHz */ | ||
1483 | iwe.u.freq.m = bss->dschannel.data; | ||
1484 | iwe.u.freq.e = 0; | ||
1485 | iwe.cmd = SIOCGIWFREQ; | ||
1486 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); | ||
1487 | |||
1488 | /* Add quality statistics */ | ||
1489 | iwe.u.qual.level = bss->signal.data; | ||
1490 | iwe.u.qual.noise = bss->noise.data; | ||
1491 | /* do a simple SNR for quality */ | ||
1492 | iwe.u.qual.qual = qual_as_percent(bss->signal.data - bss->noise.data); | ||
1493 | iwe.cmd = IWEVQUAL; | ||
1494 | current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); | ||
1495 | |||
1496 | return current_ev; | ||
1497 | } | ||
1498 | |||
1499 | |||
1500 | static int p80211wext_giwscan(netdevice_t *dev, | ||
1501 | struct iw_request_info *info, | ||
1502 | struct iw_point *srq, char *extra) | ||
1503 | { | ||
1504 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1505 | p80211msg_dot11req_scan_results_t msg; | ||
1506 | int result = 0; | ||
1507 | int err = 0; | ||
1508 | int i = 0; | ||
1509 | int scan_good = 0; | ||
1510 | char *current_ev = extra; | ||
1511 | |||
1512 | DBFENTER; | ||
1513 | |||
1514 | /* Since wireless tools doesn't really have a way of passing how | ||
1515 | * many scan results results there were back here, keep grabbing them | ||
1516 | * until we fail. | ||
1517 | */ | ||
1518 | do { | ||
1519 | memset(&msg, 0, sizeof(msg)); | ||
1520 | msg.msgcode = DIDmsg_dot11req_scan_results; | ||
1521 | msg.bssindex.data = i; | ||
1522 | |||
1523 | result = p80211req_dorequest(wlandev, (UINT8*)&msg); | ||
1524 | if ((result != 0) || | ||
1525 | (msg.resultcode.data != P80211ENUM_resultcode_success)) { | ||
1526 | break; | ||
1527 | } | ||
1528 | |||
1529 | current_ev = wext_translate_bss(info, current_ev, extra + IW_SCAN_MAX_DATA, &msg); | ||
1530 | scan_good = 1; | ||
1531 | i++; | ||
1532 | } while (i < IW_MAX_AP); | ||
1533 | |||
1534 | srq->length = (current_ev - extra); | ||
1535 | srq->flags = 0; /* todo */ | ||
1536 | |||
1537 | if (result && !scan_good) | ||
1538 | err = prism2_result2err (msg.resultcode.data); | ||
1539 | |||
1540 | DBFEXIT; | ||
1541 | return err; | ||
1542 | } | ||
1543 | #endif | ||
1544 | |||
1545 | /*****************************************************/ | ||
1546 | //extra wireless extensions stuff to support NetworkManager (I hope) | ||
1547 | |||
1548 | #if WIRELESS_EXT > 17 | ||
1549 | /* SIOCSIWENCODEEXT */ | ||
1550 | static int p80211wext_set_encodeext(struct net_device *dev, | ||
1551 | struct iw_request_info *info, | ||
1552 | union iwreq_data *wrqu, char *extra) | ||
1553 | { | ||
1554 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1555 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
1556 | p80211msg_dot11req_mibset_t msg; | ||
1557 | p80211item_pstr32_t *pstr; | ||
1558 | |||
1559 | int result = 0; | ||
1560 | struct iw_point *encoding = &wrqu->encoding; | ||
1561 | int idx = encoding->flags & IW_ENCODE_INDEX; | ||
1562 | |||
1563 | WLAN_LOG_DEBUG(1,"set_encode_ext flags[%d] alg[%d] keylen[%d]\n",ext->ext_flags,(int)ext->alg,(int)ext->key_len); | ||
1564 | |||
1565 | |||
1566 | if ( ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY ) { | ||
1567 | // set default key ? I'm not sure if this the the correct thing to do here | ||
1568 | |||
1569 | if ( idx ) { | ||
1570 | if (idx < 1 || idx > NUM_WEPKEYS) { | ||
1571 | return -EINVAL; | ||
1572 | } else | ||
1573 | idx--; | ||
1574 | } | ||
1575 | WLAN_LOG_DEBUG(1,"setting default key (%d)\n",idx); | ||
1576 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, idx); | ||
1577 | if ( result ) | ||
1578 | return -EFAULT; | ||
1579 | } | ||
1580 | |||
1581 | |||
1582 | if ( ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY ) { | ||
1583 | if ( ! ext->alg & IW_ENCODE_ALG_WEP) { | ||
1584 | WLAN_LOG_DEBUG(1,"asked to set a non wep key :("); | ||
1585 | return -EINVAL; | ||
1586 | } | ||
1587 | if (idx) { | ||
1588 | if (idx <1 || idx > NUM_WEPKEYS) | ||
1589 | return -EINVAL; | ||
1590 | else | ||
1591 | idx--; | ||
1592 | } | ||
1593 | WLAN_LOG_DEBUG(1,"Set WEP key (%d)\n",idx); | ||
1594 | wlandev->wep_keylens[idx] = ext->key_len; | ||
1595 | memcpy(wlandev->wep_keys[idx], ext->key, ext->key_len); | ||
1596 | |||
1597 | memset( &msg,0,sizeof(msg)); | ||
1598 | pstr = (p80211item_pstr32_t*)&msg.mibattribute.data; | ||
1599 | memcpy(pstr->data.data, ext->key,ext->key_len); | ||
1600 | pstr->data.len = ext->key_len; | ||
1601 | switch (idx) { | ||
1602 | case 0: | ||
1603 | pstr->did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0; | ||
1604 | break; | ||
1605 | case 1: | ||
1606 | pstr->did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1; | ||
1607 | break; | ||
1608 | case 2: | ||
1609 | pstr->did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2; | ||
1610 | break; | ||
1611 | case 3: | ||
1612 | pstr->did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3; | ||
1613 | break; | ||
1614 | default: | ||
1615 | break; | ||
1616 | } | ||
1617 | msg.msgcode = DIDmsg_dot11req_mibset; | ||
1618 | result = p80211req_dorequest(wlandev,(UINT8*)&msg); | ||
1619 | WLAN_LOG_DEBUG(1,"result (%d)\n",result); | ||
1620 | } | ||
1621 | return result; | ||
1622 | } | ||
1623 | |||
1624 | /* SIOCGIWENCODEEXT */ | ||
1625 | static int p80211wext_get_encodeext(struct net_device *dev, | ||
1626 | struct iw_request_info *info, | ||
1627 | union iwreq_data *wrqu, char *extra) | ||
1628 | |||
1629 | { | ||
1630 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1631 | struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; | ||
1632 | |||
1633 | struct iw_point *encoding = &wrqu->encoding; | ||
1634 | int result = 0; | ||
1635 | int max_len; | ||
1636 | int idx; | ||
1637 | |||
1638 | DBFENTER; | ||
1639 | |||
1640 | WLAN_LOG_DEBUG(1,"get_encode_ext flags[%d] alg[%d] keylen[%d]\n",ext->ext_flags,(int)ext->alg,(int)ext->key_len); | ||
1641 | |||
1642 | |||
1643 | max_len = encoding->length - sizeof(*ext); | ||
1644 | if ( max_len <= 0) { | ||
1645 | WLAN_LOG_DEBUG(1,"get_encodeext max_len [%d] invalid\n",max_len); | ||
1646 | result = -EINVAL; | ||
1647 | goto exit; | ||
1648 | } | ||
1649 | idx = encoding->flags & IW_ENCODE_INDEX; | ||
1650 | |||
1651 | WLAN_LOG_DEBUG(1,"get_encode_ext index [%d]\n",idx); | ||
1652 | |||
1653 | if (idx) { | ||
1654 | if (idx < 1 || idx > NUM_WEPKEYS ) { | ||
1655 | WLAN_LOG_DEBUG(1,"get_encode_ext invalid key index [%d]\n",idx); | ||
1656 | result = -EINVAL; | ||
1657 | goto exit; | ||
1658 | } | ||
1659 | idx--; | ||
1660 | } else { | ||
1661 | /* default key ? not sure what to do */ | ||
1662 | /* will just use key[0] for now ! FIX ME */ | ||
1663 | } | ||
1664 | |||
1665 | encoding->flags = idx + 1; | ||
1666 | memset(ext,0,sizeof(*ext)); | ||
1667 | |||
1668 | ext->alg = IW_ENCODE_ALG_WEP; | ||
1669 | ext->key_len = wlandev->wep_keylens[idx]; | ||
1670 | memcpy( ext->key, wlandev->wep_keys[idx] , ext->key_len ); | ||
1671 | |||
1672 | encoding->flags |= IW_ENCODE_ENABLED; | ||
1673 | exit: | ||
1674 | DBFEXIT; | ||
1675 | |||
1676 | return result; | ||
1677 | } | ||
1678 | |||
1679 | |||
1680 | /* SIOCSIWAUTH */ | ||
1681 | static int p80211_wext_set_iwauth (struct net_device *dev, | ||
1682 | struct iw_request_info *info, | ||
1683 | union iwreq_data *wrqu, char *extra) | ||
1684 | { | ||
1685 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1686 | struct iw_param *param = &wrqu->param; | ||
1687 | int result =0; | ||
1688 | |||
1689 | WLAN_LOG_DEBUG(1,"set_iwauth flags[%d]\n",(int)param->flags & IW_AUTH_INDEX ); | ||
1690 | |||
1691 | switch (param->flags & IW_AUTH_INDEX) { | ||
1692 | case IW_AUTH_DROP_UNENCRYPTED: | ||
1693 | WLAN_LOG_DEBUG(1,"drop_unencrypted %d\n",param->value); | ||
1694 | if (param->value) | ||
1695 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, P80211ENUM_truth_true); | ||
1696 | else | ||
1697 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, P80211ENUM_truth_false); | ||
1698 | break; | ||
1699 | |||
1700 | case IW_AUTH_PRIVACY_INVOKED: | ||
1701 | WLAN_LOG_DEBUG(1,"privacy invoked %d\n",param->value); | ||
1702 | if ( param->value) | ||
1703 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, P80211ENUM_truth_true); | ||
1704 | else | ||
1705 | result = p80211wext_dorequest(wlandev, DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, P80211ENUM_truth_false); | ||
1706 | |||
1707 | break; | ||
1708 | |||
1709 | case IW_AUTH_80211_AUTH_ALG: | ||
1710 | if ( param->value & IW_AUTH_ALG_OPEN_SYSTEM ) { | ||
1711 | WLAN_LOG_DEBUG(1,"set open_system\n"); | ||
1712 | wlandev->hostwep &= ~HOSTWEP_SHAREDKEY; | ||
1713 | } else if ( param->value & IW_AUTH_ALG_SHARED_KEY) { | ||
1714 | WLAN_LOG_DEBUG(1,"set shared key\n"); | ||
1715 | wlandev->hostwep |= HOSTWEP_SHAREDKEY; | ||
1716 | } else { | ||
1717 | /* don't know what to do know :( */ | ||
1718 | WLAN_LOG_DEBUG(1,"unknown AUTH_ALG (%d)\n",param->value); | ||
1719 | result = -EINVAL; | ||
1720 | } | ||
1721 | break; | ||
1722 | |||
1723 | default: | ||
1724 | break; | ||
1725 | } | ||
1726 | |||
1727 | |||
1728 | |||
1729 | return result; | ||
1730 | } | ||
1731 | |||
1732 | /* SIOCSIWAUTH */ | ||
1733 | static int p80211_wext_get_iwauth (struct net_device *dev, | ||
1734 | struct iw_request_info *info, | ||
1735 | union iwreq_data *wrqu, char *extra) | ||
1736 | { | ||
1737 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1738 | struct iw_param *param = &wrqu->param; | ||
1739 | int result =0; | ||
1740 | |||
1741 | WLAN_LOG_DEBUG(1,"get_iwauth flags[%d]\n",(int)param->flags & IW_AUTH_INDEX ); | ||
1742 | |||
1743 | switch (param->flags & IW_AUTH_INDEX) { | ||
1744 | case IW_AUTH_DROP_UNENCRYPTED: | ||
1745 | param->value = wlandev->hostwep & HOSTWEP_EXCLUDEUNENCRYPTED?1:0; | ||
1746 | break; | ||
1747 | |||
1748 | case IW_AUTH_PRIVACY_INVOKED: | ||
1749 | param->value = wlandev->hostwep & HOSTWEP_PRIVACYINVOKED?1:0; | ||
1750 | break; | ||
1751 | |||
1752 | case IW_AUTH_80211_AUTH_ALG: | ||
1753 | param->value = wlandev->hostwep & HOSTWEP_SHAREDKEY?IW_AUTH_ALG_SHARED_KEY:IW_AUTH_ALG_OPEN_SYSTEM; | ||
1754 | break; | ||
1755 | |||
1756 | |||
1757 | default: | ||
1758 | break; | ||
1759 | } | ||
1760 | |||
1761 | |||
1762 | |||
1763 | return result; | ||
1764 | } | ||
1765 | |||
1766 | |||
1767 | #endif | ||
1768 | |||
1769 | |||
1770 | |||
1771 | |||
1772 | |||
1773 | |||
1774 | /*****************************************************/ | ||
1775 | |||
1776 | |||
1777 | |||
1778 | |||
1779 | |||
1780 | /* | ||
1781 | typedef int (*iw_handler)(netdevice_t *dev, struct iw_request_info *info, | ||
1782 | union iwreq_data *wrqu, char *extra); | ||
1783 | */ | ||
1784 | |||
1785 | #if WIRELESS_EXT > 12 | ||
1786 | static iw_handler p80211wext_handlers[] = { | ||
1787 | (iw_handler) p80211wext_siwcommit, /* SIOCSIWCOMMIT */ | ||
1788 | (iw_handler) p80211wext_giwname, /* SIOCGIWNAME */ | ||
1789 | (iw_handler) NULL, /* SIOCSIWNWID */ | ||
1790 | (iw_handler) NULL, /* SIOCGIWNWID */ | ||
1791 | (iw_handler) p80211wext_siwfreq, /* SIOCSIWFREQ */ | ||
1792 | (iw_handler) p80211wext_giwfreq, /* SIOCGIWFREQ */ | ||
1793 | (iw_handler) p80211wext_siwmode, /* SIOCSIWMODE */ | ||
1794 | (iw_handler) p80211wext_giwmode, /* SIOCGIWMODE */ | ||
1795 | (iw_handler) NULL, /* SIOCSIWSENS */ | ||
1796 | (iw_handler) NULL, /* SIOCGIWSENS */ | ||
1797 | (iw_handler) NULL, /* not used */ /* SIOCSIWRANGE */ | ||
1798 | (iw_handler) p80211wext_giwrange, /* SIOCGIWRANGE */ | ||
1799 | (iw_handler) NULL, /* not used */ /* SIOCSIWPRIV */ | ||
1800 | (iw_handler) NULL, /* kernel code */ /* SIOCGIWPRIV */ | ||
1801 | (iw_handler) NULL, /* not used */ /* SIOCSIWSTATS */ | ||
1802 | (iw_handler) NULL, /* kernel code */ /* SIOCGIWSTATS */ | ||
1803 | (iw_handler) p80211wext_siwspy, /* SIOCSIWSPY */ | ||
1804 | (iw_handler) p80211wext_giwspy, /* SIOCGIWSPY */ | ||
1805 | (iw_handler) NULL, /* -- hole -- */ | ||
1806 | (iw_handler) NULL, /* -- hole -- */ | ||
1807 | (iw_handler) NULL, /* SIOCSIWAP */ | ||
1808 | (iw_handler) p80211wext_giwap, /* SIOCGIWAP */ | ||
1809 | (iw_handler) NULL, /* -- hole -- */ | ||
1810 | (iw_handler) NULL, /* SIOCGIWAPLIST */ | ||
1811 | #if WIRELESS_EXT > 13 | ||
1812 | (iw_handler) p80211wext_siwscan, /* SIOCSIWSCAN */ | ||
1813 | (iw_handler) p80211wext_giwscan, /* SIOCGIWSCAN */ | ||
1814 | #else /* WIRELESS_EXT > 13 */ | ||
1815 | (iw_handler) NULL, /* null */ /* SIOCSIWSCAN */ | ||
1816 | (iw_handler) NULL, /* null */ /* SIOCGIWSCAN */ | ||
1817 | #endif /* WIRELESS_EXT > 13 */ | ||
1818 | (iw_handler) p80211wext_siwessid, /* SIOCSIWESSID */ | ||
1819 | (iw_handler) p80211wext_giwessid, /* SIOCGIWESSID */ | ||
1820 | (iw_handler) NULL, /* SIOCSIWNICKN */ | ||
1821 | (iw_handler) p80211wext_giwessid, /* SIOCGIWNICKN */ | ||
1822 | (iw_handler) NULL, /* -- hole -- */ | ||
1823 | (iw_handler) NULL, /* -- hole -- */ | ||
1824 | (iw_handler) NULL, /* SIOCSIWRATE */ | ||
1825 | (iw_handler) p80211wext_giwrate, /* SIOCGIWRATE */ | ||
1826 | (iw_handler) p80211wext_siwrts, /* SIOCSIWRTS */ | ||
1827 | (iw_handler) p80211wext_giwrts, /* SIOCGIWRTS */ | ||
1828 | (iw_handler) p80211wext_siwfrag, /* SIOCSIWFRAG */ | ||
1829 | (iw_handler) p80211wext_giwfrag, /* SIOCGIWFRAG */ | ||
1830 | (iw_handler) p80211wext_siwtxpow, /* SIOCSIWTXPOW */ | ||
1831 | (iw_handler) p80211wext_giwtxpow, /* SIOCGIWTXPOW */ | ||
1832 | (iw_handler) p80211wext_siwretry, /* SIOCSIWRETRY */ | ||
1833 | (iw_handler) p80211wext_giwretry, /* SIOCGIWRETRY */ | ||
1834 | (iw_handler) p80211wext_siwencode, /* SIOCSIWENCODE */ | ||
1835 | (iw_handler) p80211wext_giwencode, /* SIOCGIWENCODE */ | ||
1836 | (iw_handler) NULL, /* SIOCSIWPOWER */ | ||
1837 | (iw_handler) NULL, /* SIOCGIWPOWER */ | ||
1838 | #if WIRELESS_EXT > 17 | ||
1839 | /* WPA operations */ | ||
1840 | |||
1841 | (iw_handler) NULL, /* -- hole -- */ | ||
1842 | (iw_handler) NULL, /* -- hole -- */ | ||
1843 | (iw_handler) NULL, /* SIOCSIWGENIE set generic IE */ | ||
1844 | (iw_handler) NULL, /* SIOCGIWGENIE get generic IE */ | ||
1845 | (iw_handler) p80211_wext_set_iwauth, /* SIOCSIWAUTH set authentication mode params */ | ||
1846 | (iw_handler) p80211_wext_get_iwauth, /* SIOCGIWAUTH get authentication mode params */ | ||
1847 | |||
1848 | (iw_handler) p80211wext_set_encodeext, /* SIOCSIWENCODEEXT set encoding token & mode */ | ||
1849 | (iw_handler) p80211wext_get_encodeext, /* SIOCGIWENCODEEXT get encoding token & mode */ | ||
1850 | (iw_handler) NULL, /* SIOCSIWPMKSA PMKSA cache operation */ | ||
1851 | #endif | ||
1852 | }; | ||
1853 | |||
1854 | struct iw_handler_def p80211wext_handler_def = { | ||
1855 | .num_standard = sizeof(p80211wext_handlers) / sizeof(iw_handler), | ||
1856 | .num_private = 0, | ||
1857 | .num_private_args = 0, | ||
1858 | .standard = p80211wext_handlers, | ||
1859 | .private = NULL, | ||
1860 | .private_args = NULL, | ||
1861 | #if WIRELESS_EXT > 16 | ||
1862 | .get_wireless_stats = p80211wext_get_wireless_stats | ||
1863 | #endif | ||
1864 | }; | ||
1865 | |||
1866 | #endif | ||
1867 | |||
1868 | /* wireless extensions' ioctls */ | ||
1869 | int p80211wext_support_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) | ||
1870 | { | ||
1871 | wlandevice_t *wlandev = (wlandevice_t*)dev->priv; | ||
1872 | |||
1873 | #if WIRELESS_EXT < 13 | ||
1874 | struct iwreq *iwr = (struct iwreq*)ifr; | ||
1875 | #endif | ||
1876 | |||
1877 | p80211item_uint32_t mibitem; | ||
1878 | int err = 0; | ||
1879 | |||
1880 | DBFENTER; | ||
1881 | |||
1882 | mibitem.status = P80211ENUM_msgitem_status_data_ok; | ||
1883 | |||
1884 | if ( wlandev->msdstate != WLAN_MSD_RUNNING ) { | ||
1885 | err = -ENODEV; | ||
1886 | goto exit; | ||
1887 | } | ||
1888 | |||
1889 | WLAN_LOG_DEBUG(1, "Received wireless extension ioctl #%d.\n", cmd); | ||
1890 | |||
1891 | switch (cmd) { | ||
1892 | #if WIRELESS_EXT < 13 | ||
1893 | case SIOCSIWNAME: /* unused */ | ||
1894 | err = (-EOPNOTSUPP); | ||
1895 | break; | ||
1896 | case SIOCGIWNAME: /* get name == wireless protocol */ | ||
1897 | err = p80211wext_giwname(dev, NULL, (char *) &iwr->u, NULL); | ||
1898 | break; | ||
1899 | case SIOCSIWNWID: | ||
1900 | case SIOCGIWNWID: | ||
1901 | err = (-EOPNOTSUPP); | ||
1902 | break; | ||
1903 | case SIOCSIWFREQ: /* set channel */ | ||
1904 | err = p80211wext_siwfreq(dev, NULL, &(iwr->u.freq), NULL); | ||
1905 | break; | ||
1906 | case SIOCGIWFREQ: /* get channel */ | ||
1907 | err = p80211wext_giwfreq(dev, NULL, &(iwr->u.freq), NULL); | ||
1908 | break; | ||
1909 | case SIOCSIWRANGE: | ||
1910 | case SIOCSIWPRIV: | ||
1911 | case SIOCSIWAP: /* set access point MAC addresses (BSSID) */ | ||
1912 | err = (-EOPNOTSUPP); | ||
1913 | break; | ||
1914 | |||
1915 | case SIOCGIWAP: /* get access point MAC addresses (BSSID) */ | ||
1916 | err = p80211wext_giwap(dev, NULL, &(iwr->u.ap_addr), NULL); | ||
1917 | break; | ||
1918 | |||
1919 | #if WIRELESS_EXT > 8 | ||
1920 | case SIOCSIWMODE: /* set operation mode */ | ||
1921 | case SIOCSIWESSID: /* set SSID (network name) */ | ||
1922 | case SIOCSIWRATE: /* set default bit rate (bps) */ | ||
1923 | err = (-EOPNOTSUPP); | ||
1924 | break; | ||
1925 | |||
1926 | case SIOCGIWMODE: /* get operation mode */ | ||
1927 | err = p80211wext_giwmode(dev, NULL, &iwr->u.mode, NULL); | ||
1928 | |||
1929 | break; | ||
1930 | case SIOCGIWNICKN: /* get node name/nickname */ | ||
1931 | case SIOCGIWESSID: /* get SSID */ | ||
1932 | if(iwr->u.essid.pointer) { | ||
1933 | char ssid[IW_ESSID_MAX_SIZE+1]; | ||
1934 | memset(ssid, 0, sizeof(ssid)); | ||
1935 | |||
1936 | err = p80211wext_giwessid(dev, NULL, &iwr->u.essid, ssid); | ||
1937 | if(copy_to_user(iwr->u.essid.pointer, ssid, sizeof(ssid))) | ||
1938 | err = (-EFAULT); | ||
1939 | } | ||
1940 | break; | ||
1941 | case SIOCGIWRATE: | ||
1942 | err = p80211wext_giwrate(dev, NULL, &iwr->u.bitrate, NULL); | ||
1943 | break; | ||
1944 | case SIOCGIWRTS: | ||
1945 | err = p80211wext_giwrts(dev, NULL, &iwr->u.rts, NULL); | ||
1946 | break; | ||
1947 | case SIOCGIWFRAG: | ||
1948 | err = p80211wext_giwfrag(dev, NULL, &iwr->u.rts, NULL); | ||
1949 | break; | ||
1950 | case SIOCGIWENCODE: | ||
1951 | if (!capable(CAP_NET_ADMIN)) | ||
1952 | err = -EPERM; | ||
1953 | else if (iwr->u.encoding.pointer) { | ||
1954 | char keybuf[MAX_KEYLEN]; | ||
1955 | err = p80211wext_giwencode(dev, NULL, | ||
1956 | &iwr->u.encoding, keybuf); | ||
1957 | if (copy_to_user(iwr->u.encoding.pointer, keybuf, | ||
1958 | iwr->u.encoding.length)) | ||
1959 | err = -EFAULT; | ||
1960 | } | ||
1961 | break; | ||
1962 | case SIOCGIWAPLIST: | ||
1963 | case SIOCSIWRTS: | ||
1964 | case SIOCSIWFRAG: | ||
1965 | case SIOCSIWSENS: | ||
1966 | case SIOCGIWSENS: | ||
1967 | case SIOCSIWNICKN: /* set node name/nickname */ | ||
1968 | case SIOCSIWENCODE: /* set encoding token & mode */ | ||
1969 | case SIOCSIWSPY: | ||
1970 | case SIOCGIWSPY: | ||
1971 | case SIOCSIWPOWER: | ||
1972 | case SIOCGIWPOWER: | ||
1973 | case SIOCGIWPRIV: | ||
1974 | err = (-EOPNOTSUPP); | ||
1975 | break; | ||
1976 | case SIOCGIWRANGE: | ||
1977 | if(iwr->u.data.pointer != NULL) { | ||
1978 | struct iw_range range; | ||
1979 | err = p80211wext_giwrange(dev, NULL, &iwr->u.data, | ||
1980 | (char *) &range); | ||
1981 | /* Push that up to the caller */ | ||
1982 | if (copy_to_user(iwr->u.data.pointer, &range, sizeof(range))) | ||
1983 | err = -EFAULT; | ||
1984 | } | ||
1985 | break; | ||
1986 | #endif /* WIRELESS_EXT > 8 */ | ||
1987 | #if WIRELESS_EXT > 9 | ||
1988 | case SIOCSIWTXPOW: | ||
1989 | err = (-EOPNOTSUPP); | ||
1990 | break; | ||
1991 | case SIOCGIWTXPOW: | ||
1992 | err = p80211wext_giwtxpow(dev, NULL, &iwr->u.txpower, NULL); | ||
1993 | break; | ||
1994 | #endif /* WIRELESS_EXT > 9 */ | ||
1995 | #if WIRELESS_EXT > 10 | ||
1996 | case SIOCSIWRETRY: | ||
1997 | err = (-EOPNOTSUPP); | ||
1998 | break; | ||
1999 | case SIOCGIWRETRY: | ||
2000 | err = p80211wext_giwretry(dev, NULL, &iwr->u.retry, NULL); | ||
2001 | break; | ||
2002 | #endif /* WIRELESS_EXT > 10 */ | ||
2003 | |||
2004 | #endif /* WIRELESS_EXT <= 12 */ | ||
2005 | |||
2006 | default: | ||
2007 | err = (-EOPNOTSUPP); | ||
2008 | break; | ||
2009 | } | ||
2010 | |||
2011 | exit: | ||
2012 | DBFEXIT; | ||
2013 | return (err); | ||
2014 | } | ||
2015 | |||
2016 | int p80211wext_event_associated(wlandevice_t *wlandev, int assoc) | ||
2017 | { | ||
2018 | union iwreq_data data; | ||
2019 | |||
2020 | DBFENTER; | ||
2021 | |||
2022 | #if WIRELESS_EXT > 13 | ||
2023 | /* Send the association state first */ | ||
2024 | data.ap_addr.sa_family = ARPHRD_ETHER; | ||
2025 | if (assoc) { | ||
2026 | memcpy(data.ap_addr.sa_data, wlandev->bssid, WLAN_ADDR_LEN); | ||
2027 | } else { | ||
2028 | memset(data.ap_addr.sa_data, 0, WLAN_ADDR_LEN); | ||
2029 | } | ||
2030 | |||
2031 | if (wlan_wext_write) | ||
2032 | wireless_send_event(wlandev->netdev, SIOCGIWAP, &data, NULL); | ||
2033 | |||
2034 | if (!assoc) goto done; | ||
2035 | |||
2036 | // XXX send association data, like IEs, etc etc. | ||
2037 | #endif | ||
2038 | done: | ||
2039 | DBFEXIT; | ||
2040 | return 0; | ||
2041 | } | ||
2042 | |||
2043 | |||
2044 | #endif /* compatibility to wireless extensions */ | ||
2045 | |||
2046 | |||
2047 | |||
2048 | |||
diff --git a/drivers/staging/wlan-ng/prism2_cs.c b/drivers/staging/wlan-ng/prism2_cs.c new file mode 100644 index 000000000000..63ce5659f21a --- /dev/null +++ b/drivers/staging/wlan-ng/prism2_cs.c | |||
@@ -0,0 +1,1487 @@ | |||
1 | #define WLAN_HOSTIF WLAN_PCMCIA | ||
2 | #include "hfa384x.c" | ||
3 | #include "prism2mgmt.c" | ||
4 | #include "prism2mib.c" | ||
5 | #include "prism2sta.c" | ||
6 | |||
7 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,21) ) | ||
8 | #if (WLAN_CPU_FAMILY == WLAN_Ix86) | ||
9 | #ifndef CONFIG_ISA | ||
10 | #warning "You may need to enable ISA support in your kernel." | ||
11 | #endif | ||
12 | #endif | ||
13 | #endif | ||
14 | |||
15 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) ) | ||
16 | static u_int irq_mask = 0xdeb8; /* Interrupt mask */ | ||
17 | static int irq_list[4] = { -1 }; /* Interrupt list */ | ||
18 | #endif | ||
19 | static u_int prism2_ignorevcc=1; /* Boolean, if set, we | ||
20 | * ignore what the Vcc | ||
21 | * is set to and what the CIS | ||
22 | * says. | ||
23 | */ | ||
24 | module_param( prism2_ignorevcc, int, 0644); | ||
25 | |||
26 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) ) | ||
27 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,9)) | ||
28 | static int numlist = 4; | ||
29 | module_param_array(irq_list, int, numlist, 0444); | ||
30 | #else | ||
31 | module_param_array(irq_list, int, NULL, 0444); | ||
32 | #endif | ||
33 | module_param( irq_mask, int, 0644); | ||
34 | #endif | ||
35 | |||
36 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) | ||
37 | static int prism2_cs_suspend(struct pcmcia_device *pdev); | ||
38 | static int prism2_cs_resume(struct pcmcia_device *pdev); | ||
39 | static void prism2_cs_remove(struct pcmcia_device *pdev); | ||
40 | static int prism2_cs_probe(struct pcmcia_device *pdev); | ||
41 | #else | ||
42 | dev_link_t *prism2sta_attach(void); | ||
43 | static void prism2sta_detach(dev_link_t *link); | ||
44 | static void prism2sta_config(dev_link_t *link); | ||
45 | static void prism2sta_release(u_long arg); | ||
46 | static int prism2sta_event (event_t event, int priority, event_callback_args_t *args); | ||
47 | |||
48 | static dev_link_t *dev_list = NULL; /* head of instance list */ | ||
49 | #endif | ||
50 | |||
51 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) | ||
52 | /*---------------------------------------------------------------- | ||
53 | * cs_error | ||
54 | * | ||
55 | * Utility function to print card services error messages. | ||
56 | * | ||
57 | * Arguments: | ||
58 | * handle client handle identifying this CS client | ||
59 | * func CS function number that generated the error | ||
60 | * ret CS function return code | ||
61 | * | ||
62 | * Returns: | ||
63 | * nothing | ||
64 | * Side effects: | ||
65 | * | ||
66 | * Call context: | ||
67 | * process thread | ||
68 | * interrupt | ||
69 | ----------------------------------------------------------------*/ | ||
70 | static void cs_error(client_handle_t handle, int func, int ret) | ||
71 | { | ||
72 | #if (defined(CS_RELEASE_CODE) && (CS_RELEASE_CODE < 0x2911)) | ||
73 | CardServices(ReportError, dev_info, (void *)func, (void *)ret); | ||
74 | #else | ||
75 | error_info_t err = { func, ret }; | ||
76 | pcmcia_report_error(handle, &err); | ||
77 | #endif | ||
78 | } | ||
79 | #else // kernel_version | ||
80 | |||
81 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12) | ||
82 | static struct pcmcia_device_id prism2_cs_ids[] = { | ||
83 | PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), // Intersil PRISM2 Reference Design 11Mb/s 802.11b WLAN Card | ||
84 | PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), // Compaq WL100/200 11Mb/s 802.11b WLAN Card | ||
85 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), // Compaq iPaq HNW-100 11Mb/s 802.11b WLAN Card | ||
86 | PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), // Samsung SWL2000-N 11Mb/s 802.11b WLAN Card | ||
87 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), // Z-Com XI300 11Mb/s 802.11b WLAN Card | ||
88 | PCMCIA_DEVICE_PROD_ID12("ZoomAir 11Mbps High", "Rate wireless Networking", 0x273fe3db, 0x32a1eaee), // ZoomAir 4100 11Mb/s 802.11b WLAN Card | ||
89 | PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), // Linksys WPC11 11Mbps 802.11b WLAN Card | ||
90 | PCMCIA_DEVICE_PROD_ID123("Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02", 0xe6ec52ce, 0x8649af2, 0x4b74baa0), // Addtron AWP-100 11Mbps 802.11b WLAN Card | ||
91 | PCMCIA_DEVICE_PROD_ID123("D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02", 0x71b18589, 0xb6f1b0ab, 0x4b74baa0), // D-Link DWL-650 11Mbps 802.11b WLAN Card | ||
92 | PCMCIA_DEVICE_PROD_ID123("SMC", "SMC2632W", "Version 01.02", 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0), // SMC 2632W 11Mbps 802.11b WLAN Card | ||
93 | PCMCIA_DEVICE_PROD_ID1234("Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P", "Eval-RevA", 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e), // BroMax Freeport 11Mbps 802.11b WLAN Card (Prism 2.5) | ||
94 | PCMCIA_DEVICE_PROD_ID123("U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02", 0xc7b8df9d, 0x1700d087, 0x4b74baa0), // U.S. Robotics IEEE 802.11b PC-CARD | ||
95 | PCMCIA_DEVICE_PROD_ID12("Digital Data Communications", "WPC-0100", 0xfdd73470, 0xe0b6f146), // Level-One WPC-0100 | ||
96 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), // Bromax OEM 11Mbps 802.11b WLAN Card (Prism 2.5) | ||
97 | PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), // Bromax OEM 11Mbps 802.11b WLAN Card (Prism 3) | ||
98 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584), // corega K.K. Wireless LAN PCC-11 | ||
99 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9), // corega K.K. Wireless LAN PCCA-11 | ||
100 | PCMCIA_DEVICE_MANF_CARD(0xc001, 0x0008), // CONTEC FLEXSCAN/FX-DDS110-PCC | ||
101 | PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-NS110", 0x209f40ab, 0x46263178), // PLANEX GeoWave/GW-NS110 | ||
102 | PCMCIA_DEVICE_PROD_ID123("OEM", "PRISM2 IEEE 802.11 PC-Card", "Version 01.02", 0xfea54c90, 0x48f2bdd6, 0x4b74baa0), // Ambicom WL1100 11Mbps 802.11b WLAN Card | ||
103 | PCMCIA_DEVICE_PROD_ID123("LeArtery", "SYNCBYAIR 11Mbps Wireless LAN PC Card", "Version 01.02", 0x7e3b326a, 0x49893e92, 0x4b74baa0), // LeArtery SYNCBYAIR 11Mbps 802.11b WLAN Card | ||
104 | PCMCIA_DEVICE_MANF_CARD(0x01ff, 0x0008), // Intermec MobileLAN 11Mbps 802.11b WLAN Card | ||
105 | PCMCIA_DEVICE_PROD_ID123("NETGEAR MA401 Wireless PC", "Card", "Version 01.00", 0xa37434e9, 0x9762e8f1, 0xa57adb8c), // NETGEAR MA401 11Mbps 802.11 WLAN Card | ||
106 | PCMCIA_DEVICE_PROD_ID1234("Intersil", "PRISM Freedom PCMCIA Adapter", "ISL37100P", "Eval-RevA", 0x4b801a17, 0xf222ec2d, 0x630d52b2, 0xc23adc0e), // Intersil PRISM Freedom 11mbps 802.11 WLAN Card | ||
107 | PCMCIA_DEVICE_PROD_ID123("OTC", "Wireless AirEZY 2411-PCC WLAN Card", "Version 01.02", 0x4ac44287, 0x235a6bed, 0x4b74baa0), // OTC Wireless AirEZY 2411-PCC 11Mbps 802.11 WLAN Card | ||
108 | PCMCIA_DEVICE_PROD_ID1234("802.11", "11Mbps Wireless LAN Card", "v08C1", "" , 0xb67a610e, 0x655aa7b7, 0x264b451a, 0x0), // Dynalink L11HDT 11Mbps 802.11 WLAN Card | ||
109 | PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), // Dynalink L11HDT 11Mbps 802.11 WLAN Card | ||
110 | PCMCIA_DEVICE_PROD_ID12("PROXIM", "RangeLAN-DS/LAN PC CARD", 0xc6536a5e, 0x3f35797d), // PROXIM RangeLAN-DS/LAN PC CARD | ||
111 | PCMCIA_DEVICE_PROD_ID1234("ACTIONTEC", "PRISM Wireless LAN PC Card", "0381", "RevA", 0x393089da, 0xa71e69d5, 0x90471fa9, 0x57a66194), // ACTIONTEC PRISM Wireless LAN PC Card | ||
112 | PCMCIA_DEVICE_MANF_CARD(0x1668, 0x0101), // ACTIONTEC PRISM Wireless LAN PC Card | ||
113 | PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), // 3Com AirConnect 3CRWE737A | ||
114 | PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE777A AirConnect Wireless LAN PCI Card" , 0x41240e5b, 0xafc7c33e), // 3Com AirConnect 3CRWE777A | ||
115 | PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11b_PC_CARD_25", 0x78fc06ee, 0xdb9aa842), // ASUS WL-100 802.11b WLAN PC Card | ||
116 | PCMCIA_DEVICE_PROD_ID12("ASUS", "802_11B_CF_CARD_25", 0x78fc06ee, 0x45a50c1e), // ASUS WL-110 802.11b WLAN CF Card | ||
117 | PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G", 0x2decece3, 0x82067c18), // BUFFALO WLI-CF-S11G 802.11b WLAN Card | ||
118 | PCMCIA_DEVICE_PROD_ID1234("The Linksys Group, Inc.", "Wireless Network CF Card", "ISL37300P", "RevA", 0xa5f472c2, 0x9c05598d, 0xc9049a39, 0x57a66194), // Linksys WCF11 11Mbps 802.11b WLAN Card (Prism 2.5) | ||
119 | PCMCIA_DEVICE_PROD_ID1234("Linksys", "Wireless CompactFlash Card", "", "", 0x733cc81, 0xc52f395, 0x0, 0x0), // Linksys WCF12 11Mbps 802.11b WLAN Card (Prism 3) | ||
120 | PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), // Linksys WCF12 11Mbps 802.11b WLAN Card (Prism 3) | ||
121 | PCMCIA_DEVICE_PROD_ID1234("NETGEAR MA401RA Wireless PC", "Card", "ISL37300P", "Eval-RevA", 0x306467f, 0x9762e8f1, 0xc9049a39, 0xc23adc0e), // NETGEAR MA401RA 11Mbps 802.11 WLAN Card | ||
122 | PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), // D-Link DCF-660W 11Mbps 802.11b WLAN Card | ||
123 | PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001), // Microsoft Wireless Notebook Adapter MN-520 | ||
124 | PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0002), // AnyPoint(TM) Wireless II PC Card | ||
125 | PCMCIA_DEVICE_PROD_ID1234("D", "Link DRC-650 11Mbps WLAN Card", "Version 01.02", "" , 0x71b18589, 0xf144e3ac, 0x4b74baa0, 0x0), // D-Link DRC-650 802.11b WLAN Card | ||
126 | PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), // Adaptec AWN-8030 | ||
127 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7110), // D-Link DWL-650 rev P 802.11b WLAN card | ||
128 | // PCMCIA_DEVICE_PROD_ID1234("D-Link", "DWL-650 Wireless PC Card RevP", "ISL37101P-10", "A3", 0x1a424a1c, 0x6ea57632, 0xdd97a26b, 0x56b21f52), // D-Link DWL-650 rev P 802.11b WLAN card | ||
129 | PCMCIA_DEVICE_PROD_ID123("INTERSIL", "I-GATE 11M PC Card / PC Card plus", "Version 01.02", 0x74c5e40d, 0x8304ff77, 0x4b74baa0), // I-Gate 11M PC Card | ||
130 | PCMCIA_DEVICE_PROD_ID1234("BENQ", "AWL100 PCMCIA ADAPTER", "ISL37300P", "Eval-RevA", 0x35dadc74, 0x1f7fedb, 0xc9049a39, 0xc23adc0e), // benQ AWL100 802.11b WLAN Card | ||
131 | PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), // benQ AWL100 802.11b WLAN Card | ||
132 | // PCMCIA_DEVICE_PROD_ID1("INTERSIL", 0x74c5e40d), // Intersil Prism 2 card | ||
133 | // PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), // Intersil Prism 2 card | ||
134 | |||
135 | PCMCIA_DEVICE_NULL | ||
136 | }; | ||
137 | |||
138 | MODULE_DEVICE_TABLE(pcmcia, prism2_cs_ids); | ||
139 | #endif | ||
140 | |||
141 | static struct pcmcia_driver prism2_cs_driver = { | ||
142 | .drv = { | ||
143 | .name = "prism2_cs", | ||
144 | }, | ||
145 | .owner = THIS_MODULE, | ||
146 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) | ||
147 | .suspend = prism2_cs_suspend, | ||
148 | .resume = prism2_cs_resume, | ||
149 | .remove = prism2_cs_remove, | ||
150 | .probe = prism2_cs_probe, | ||
151 | .id_table = prism2_cs_ids, | ||
152 | #else | ||
153 | .attach = prism2sta_attach, | ||
154 | .detach = prism2sta_detach, | ||
155 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12) | ||
156 | .id_table = prism2_cs_ids, | ||
157 | .event = prism2sta_event, | ||
158 | #endif // > 2.6.12 | ||
159 | #endif // <= 2.6.15 | ||
160 | }; | ||
161 | #endif /* kernel_version */ | ||
162 | |||
163 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) | ||
164 | #define CS_CHECK(fn, ret) \ | ||
165 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
166 | |||
167 | #define CFG_CHECK(fn, retf) \ | ||
168 | do { int ret = (retf); \ | ||
169 | if (ret != 0) { \ | ||
170 | WLAN_LOG_DEBUG(1, "CardServices(" #fn ") returned %d\n", ret); \ | ||
171 | cs_error(pdev, fn, ret); \ | ||
172 | goto next_entry; \ | ||
173 | } \ | ||
174 | } while (0) | ||
175 | |||
176 | static void prism2_cs_remove(struct pcmcia_device *pdev) | ||
177 | { | ||
178 | struct wlandevice *wlandev; | ||
179 | |||
180 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) | ||
181 | dev_link_t *link = dev_to_instance(pdev); | ||
182 | #endif | ||
183 | |||
184 | DBFENTER; | ||
185 | |||
186 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
187 | wlandev = pdev->priv; | ||
188 | #else | ||
189 | wlandev = link->priv; | ||
190 | #endif | ||
191 | |||
192 | if (wlandev) { | ||
193 | p80211netdev_hwremoved(wlandev); | ||
194 | unregister_wlandev(wlandev); | ||
195 | wlan_unsetup(wlandev); | ||
196 | if (wlandev->priv) { | ||
197 | hfa384x_t *hw = wlandev->priv; | ||
198 | wlandev->priv = NULL; | ||
199 | if (hw) { | ||
200 | hfa384x_destroy(hw); | ||
201 | kfree(hw); | ||
202 | } | ||
203 | } | ||
204 | kfree(wlandev); | ||
205 | } | ||
206 | |||
207 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
208 | pdev->priv = NULL; | ||
209 | pcmcia_disable_device(pdev); | ||
210 | #else | ||
211 | if (link->state & DEV_CONFIG) { | ||
212 | if (link->win) | ||
213 | pcmcia_release_window(link->win); | ||
214 | pcmcia_release_configuration(link->handle); | ||
215 | if (link->io.NumPorts1) | ||
216 | pcmcia_release_io(link->handle, &link->io); | ||
217 | if (link->irq.AssignedIRQ) | ||
218 | pcmcia_release_irq(link->handle, &link->irq); | ||
219 | |||
220 | link->state &= ~DEV_CONFIG; | ||
221 | } | ||
222 | |||
223 | link->priv = NULL; | ||
224 | kfree(link); | ||
225 | #endif | ||
226 | |||
227 | DBFEXIT; | ||
228 | return; | ||
229 | } | ||
230 | |||
231 | static int prism2_cs_suspend(struct pcmcia_device *pdev) | ||
232 | { | ||
233 | struct wlandevice *wlandev; | ||
234 | |||
235 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) | ||
236 | dev_link_t *link = dev_to_instance(pdev); | ||
237 | #endif | ||
238 | |||
239 | DBFENTER; | ||
240 | |||
241 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
242 | wlandev = pdev->priv; | ||
243 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
244 | #else | ||
245 | wlandev = link->priv; | ||
246 | |||
247 | link->state |= DEV_SUSPEND; | ||
248 | if (link->state & DEV_CONFIG) { | ||
249 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
250 | pcmcia_release_configuration(link->handle); | ||
251 | } | ||
252 | #endif | ||
253 | |||
254 | DBFEXIT; | ||
255 | |||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | static int prism2_cs_resume(struct pcmcia_device *pdev) | ||
260 | { | ||
261 | struct wlandevice *wlandev; | ||
262 | |||
263 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) | ||
264 | dev_link_t *link = dev_to_instance(pdev); | ||
265 | #endif | ||
266 | |||
267 | DBFENTER; | ||
268 | |||
269 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
270 | wlandev = pdev->priv; | ||
271 | // XXX do something here? | ||
272 | #else | ||
273 | wlandev = link->priv; | ||
274 | link->state &= ~DEV_SUSPEND; | ||
275 | if (link->state & DEV_CONFIG) { | ||
276 | pcmcia_request_configuration(link->handle, &link->conf); | ||
277 | // XXX do something here? | ||
278 | } | ||
279 | #endif | ||
280 | |||
281 | |||
282 | DBFEXIT; | ||
283 | |||
284 | return 0; | ||
285 | } | ||
286 | |||
287 | static int prism2_cs_probe(struct pcmcia_device *pdev) | ||
288 | { | ||
289 | int rval = 0; | ||
290 | struct wlandevice *wlandev = NULL; | ||
291 | hfa384x_t *hw = NULL; | ||
292 | |||
293 | config_info_t socketconf; | ||
294 | cisparse_t *parse = NULL; | ||
295 | tuple_t tuple; | ||
296 | uint8_t buf[64]; | ||
297 | int last_fn, last_ret; | ||
298 | cistpl_cftable_entry_t dflt = { 0 }; | ||
299 | |||
300 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) | ||
301 | dev_link_t *link; | ||
302 | #endif | ||
303 | |||
304 | DBFENTER; | ||
305 | |||
306 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
307 | /* Set up interrupt type */ | ||
308 | pdev->conf.IntType = INT_MEMORY_AND_IO; | ||
309 | #else | ||
310 | link = kmalloc(sizeof(dev_link_t), GFP_KERNEL); | ||
311 | if (link == NULL) | ||
312 | return -ENOMEM; | ||
313 | memset(link, 0, sizeof(dev_link_t)); | ||
314 | |||
315 | link->conf.Vcc = 33; | ||
316 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
317 | |||
318 | link->handle = pdev; | ||
319 | pdev->instance = link; | ||
320 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
321 | |||
322 | #endif | ||
323 | |||
324 | // VCC crap? | ||
325 | parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); | ||
326 | |||
327 | wlandev = create_wlan(); | ||
328 | if (!wlandev || !parse) { | ||
329 | WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info); | ||
330 | rval = -EIO; | ||
331 | goto failed; | ||
332 | } | ||
333 | hw = wlandev->priv; | ||
334 | |||
335 | if ( wlan_setup(wlandev) != 0 ) { | ||
336 | WLAN_LOG_ERROR("%s: wlan_setup() failed.\n", dev_info); | ||
337 | rval = -EIO; | ||
338 | goto failed; | ||
339 | } | ||
340 | |||
341 | /* Initialize the hw struct for now */ | ||
342 | hfa384x_create(hw, 0, 0, NULL); | ||
343 | hw->wlandev = wlandev; | ||
344 | |||
345 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
346 | hw->pdev = pdev; | ||
347 | pdev->priv = wlandev; | ||
348 | #else | ||
349 | hw->link = link; | ||
350 | link->priv = wlandev; | ||
351 | #endif | ||
352 | |||
353 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
354 | tuple.Attributes = 0; | ||
355 | tuple.TupleData = buf; | ||
356 | tuple.TupleDataMax = sizeof(buf); | ||
357 | tuple.TupleOffset = 0; | ||
358 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(pdev, &tuple)); | ||
359 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(pdev, &tuple)); | ||
360 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(pdev, &tuple, parse)); | ||
361 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
362 | pdev->conf.ConfigBase = parse->config.base; | ||
363 | pdev->conf.Present = parse->config.rmask[0]; | ||
364 | #else | ||
365 | link->conf.ConfigBase = parse->config.base; | ||
366 | link->conf.Present = parse->config.rmask[0]; | ||
367 | |||
368 | link->conf.Vcc = socketconf.Vcc; | ||
369 | #endif | ||
370 | CS_CHECK(GetConfigurationInfo, | ||
371 | pcmcia_get_configuration_info(pdev, &socketconf)); | ||
372 | |||
373 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
374 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(pdev, &tuple)); | ||
375 | for (;;) { | ||
376 | cistpl_cftable_entry_t *cfg = &(parse->cftable_entry); | ||
377 | CFG_CHECK(GetTupleData, | ||
378 | pcmcia_get_tuple_data(pdev, &tuple)); | ||
379 | CFG_CHECK(ParseTuple, | ||
380 | pcmcia_parse_tuple(pdev, &tuple, parse)); | ||
381 | |||
382 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
383 | dflt = *cfg; | ||
384 | if (cfg->index == 0) | ||
385 | goto next_entry; | ||
386 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
387 | pdev->conf.ConfigIndex = cfg->index; | ||
388 | #else | ||
389 | link->conf.ConfigIndex = cfg->index; | ||
390 | #endif | ||
391 | |||
392 | /* Does this card need audio output? */ | ||
393 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
394 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
395 | pdev->conf.Attributes |= CONF_ENABLE_SPKR; | ||
396 | pdev->conf.Status = CCSR_AUDIO_ENA; | ||
397 | #else | ||
398 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
399 | link->conf.Status = CCSR_AUDIO_ENA; | ||
400 | #endif | ||
401 | } | ||
402 | |||
403 | /* Use power settings for Vcc and Vpp if present */ | ||
404 | /* Note that the CIS values need to be rescaled */ | ||
405 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
406 | if (socketconf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / | ||
407 | 10000 && !prism2_ignorevcc) { | ||
408 | WLAN_LOG_DEBUG(1, " Vcc mismatch - skipping" | ||
409 | " this entry\n"); | ||
410 | goto next_entry; | ||
411 | } | ||
412 | } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
413 | if (socketconf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] / | ||
414 | 10000 && !prism2_ignorevcc) { | ||
415 | WLAN_LOG_DEBUG(1, " Vcc (default) mismatch " | ||
416 | "- skipping this entry\n"); | ||
417 | goto next_entry; | ||
418 | } | ||
419 | } | ||
420 | |||
421 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { | ||
422 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
423 | pdev->conf.Vpp = | ||
424 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
425 | #else | ||
426 | link->conf.Vpp1 = link->conf.Vpp2 = | ||
427 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
428 | #endif | ||
429 | } else if (dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) { | ||
430 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
431 | pdev->conf.Vpp = | ||
432 | dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
433 | #else | ||
434 | link->conf.Vpp1 = link->conf.Vpp2 = | ||
435 | dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
436 | #endif | ||
437 | } | ||
438 | |||
439 | /* Do we need to allocate an interrupt? */ | ||
440 | /* HACK: due to a bad CIS....we ALWAYS need an interrupt */ | ||
441 | /* if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) */ | ||
442 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
443 | pdev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
444 | #else | ||
445 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
446 | #endif | ||
447 | |||
448 | /* IO window settings */ | ||
449 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
450 | pdev->io.NumPorts1 = pdev->io.NumPorts2 = 0; | ||
451 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
452 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
453 | pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
454 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
455 | pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
456 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
457 | pdev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
458 | pdev->io.BasePort1 = io->win[0].base; | ||
459 | if ( pdev->io.BasePort1 != 0 ) { | ||
460 | WLAN_LOG_WARNING( | ||
461 | "Brain damaged CIS: hard coded iobase=" | ||
462 | "0x%x, try letting pcmcia_cs decide...\n", | ||
463 | pdev->io.BasePort1 ); | ||
464 | pdev->io.BasePort1 = 0; | ||
465 | } | ||
466 | pdev->io.NumPorts1 = io->win[0].len; | ||
467 | if (io->nwin > 1) { | ||
468 | pdev->io.Attributes2 = pdev->io.Attributes1; | ||
469 | pdev->io.BasePort2 = io->win[1].base; | ||
470 | pdev->io.NumPorts2 = io->win[1].len; | ||
471 | } | ||
472 | } | ||
473 | /* This reserves IO space but doesn't actually enable it */ | ||
474 | CFG_CHECK(RequestIO, pcmcia_request_io(pdev, &pdev->io)); | ||
475 | #else | ||
476 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
477 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
478 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
479 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
480 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
481 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
482 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
483 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
484 | link->io.BasePort1 = io->win[0].base; | ||
485 | if ( link->io.BasePort1 != 0 ) { | ||
486 | WLAN_LOG_WARNING( | ||
487 | "Brain damaged CIS: hard coded iobase=" | ||
488 | "0x%x, try letting pcmcia_cs decide...\n", | ||
489 | link->io.BasePort1 ); | ||
490 | link->io.BasePort1 = 0; | ||
491 | } | ||
492 | link->io.NumPorts1 = io->win[0].len; | ||
493 | if (io->nwin > 1) { | ||
494 | link->io.Attributes2 = link->io.Attributes1; | ||
495 | link->io.BasePort2 = io->win[1].base; | ||
496 | link->io.NumPorts2 = io->win[1].len; | ||
497 | } | ||
498 | } | ||
499 | /* This reserves IO space but doesn't actually enable it */ | ||
500 | CFG_CHECK(RequestIO, pcmcia_request_io(pdev, &link->io)); | ||
501 | #endif | ||
502 | /* If we got this far, we're cool! */ | ||
503 | break; | ||
504 | |||
505 | next_entry: | ||
506 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
507 | dflt = *cfg; | ||
508 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(pdev, &tuple)); | ||
509 | |||
510 | } | ||
511 | |||
512 | /* Let pcmcia know the device name */ | ||
513 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
514 | pdev->dev_node = &hw->node; | ||
515 | #else | ||
516 | link->dev = &hw->node; | ||
517 | #endif | ||
518 | |||
519 | /* Register the network device and get assigned a name */ | ||
520 | SET_MODULE_OWNER(wlandev->netdev); | ||
521 | SET_NETDEV_DEV(wlandev->netdev, &handle_to_dev(pdev)); | ||
522 | if (register_wlandev(wlandev) != 0) { | ||
523 | WLAN_LOG_NOTICE("prism2sta_cs: register_wlandev() failed.\n"); | ||
524 | goto failed; | ||
525 | } | ||
526 | |||
527 | strcpy(hw->node.dev_name, wlandev->name); | ||
528 | |||
529 | /* Allocate an interrupt line. Note that this does not assign a */ | ||
530 | /* handler to the interrupt, unless the 'Handler' member of the */ | ||
531 | /* irq structure is initialized. */ | ||
532 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
533 | if (pdev->conf.Attributes & CONF_ENABLE_IRQ) { | ||
534 | pdev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
535 | pdev->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | ||
536 | pdev->irq.Handler = hfa384x_interrupt; | ||
537 | pdev->irq.Instance = wlandev; | ||
538 | CS_CHECK(RequestIRQ, pcmcia_request_irq(pdev, &pdev->irq)); | ||
539 | } | ||
540 | #else | ||
541 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | ||
542 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
543 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | ||
544 | link->irq.Handler = hfa384x_interrupt; | ||
545 | link->irq.Instance = wlandev; | ||
546 | CS_CHECK(RequestIRQ, pcmcia_request_irq(pdev, &link->irq)); | ||
547 | } | ||
548 | #endif | ||
549 | |||
550 | /* This actually configures the PCMCIA socket -- setting up */ | ||
551 | /* the I/O windows and the interrupt mapping, and putting the */ | ||
552 | /* card and host interface into "Memory and IO" mode. */ | ||
553 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
554 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(pdev, &pdev->conf)); | ||
555 | #else | ||
556 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(pdev, &link->conf)); | ||
557 | #endif | ||
558 | |||
559 | /* Fill the netdevice with this info */ | ||
560 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
561 | wlandev->netdev->irq = pdev->irq.AssignedIRQ; | ||
562 | wlandev->netdev->base_addr = pdev->io.BasePort1; | ||
563 | #else | ||
564 | wlandev->netdev->irq = link->irq.AssignedIRQ; | ||
565 | wlandev->netdev->base_addr = link->io.BasePort1; | ||
566 | #endif | ||
567 | |||
568 | /* And the rest of the hw structure */ | ||
569 | hw->irq = wlandev->netdev->irq; | ||
570 | hw->iobase = wlandev->netdev->base_addr; | ||
571 | |||
572 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) | ||
573 | link->state |= DEV_CONFIG; | ||
574 | link->state &= ~DEV_CONFIG_PENDING; | ||
575 | #endif | ||
576 | |||
577 | /* And now we're done! */ | ||
578 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
579 | |||
580 | goto done; | ||
581 | |||
582 | cs_failed: | ||
583 | cs_error(pdev, last_fn, last_ret); | ||
584 | |||
585 | failed: | ||
586 | // wlandev, hw, etc etc.. | ||
587 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
588 | pdev->priv = NULL; | ||
589 | #else | ||
590 | pdev->instance = NULL; | ||
591 | if (link) { | ||
592 | link->priv = NULL; | ||
593 | kfree(link); | ||
594 | } | ||
595 | #endif | ||
596 | if (wlandev) { | ||
597 | wlan_unsetup(wlandev); | ||
598 | if (wlandev->priv) { | ||
599 | hw = wlandev->priv; | ||
600 | wlandev->priv = NULL; | ||
601 | if (hw) { | ||
602 | hfa384x_destroy(hw); | ||
603 | kfree(hw); | ||
604 | } | ||
605 | } | ||
606 | kfree(wlandev); | ||
607 | } | ||
608 | |||
609 | done: | ||
610 | if (parse) kfree(parse); | ||
611 | |||
612 | DBFEXIT; | ||
613 | return rval; | ||
614 | } | ||
615 | #else // <= 2.6.15 | ||
616 | #define CS_CHECK(fn, ret) \ | ||
617 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
618 | |||
619 | #define CFG_CHECK(fn, retf) \ | ||
620 | do { int ret = (retf); \ | ||
621 | if (ret != 0) { \ | ||
622 | WLAN_LOG_DEBUG(1, "CardServices(" #fn ") returned %d\n", ret); \ | ||
623 | cs_error(link->handle, fn, ret); \ | ||
624 | goto next_entry; \ | ||
625 | } \ | ||
626 | } while (0) | ||
627 | |||
628 | /*---------------------------------------------------------------- | ||
629 | * prism2sta_attach | ||
630 | * | ||
631 | * Half of the attach/detach pair. Creates and registers a device | ||
632 | * instance with Card Services. In this case, it also creates the | ||
633 | * wlandev structure and device private structure. These are | ||
634 | * linked to the device instance via its priv member. | ||
635 | * | ||
636 | * Arguments: | ||
637 | * none | ||
638 | * | ||
639 | * Returns: | ||
640 | * A valid ptr to dev_link_t on success, NULL otherwise | ||
641 | * | ||
642 | * Side effects: | ||
643 | * | ||
644 | * | ||
645 | * Call context: | ||
646 | * process thread (insmod/init_module/register_pccard_driver) | ||
647 | ----------------------------------------------------------------*/ | ||
648 | dev_link_t *prism2sta_attach(void) | ||
649 | { | ||
650 | client_reg_t client_reg; | ||
651 | int result; | ||
652 | dev_link_t *link = NULL; | ||
653 | wlandevice_t *wlandev = NULL; | ||
654 | hfa384x_t *hw = NULL; | ||
655 | |||
656 | DBFENTER; | ||
657 | |||
658 | /* Alloc our structures */ | ||
659 | link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); | ||
660 | |||
661 | if (!link || ((wlandev = create_wlan()) == NULL)) { | ||
662 | WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info); | ||
663 | result = -EIO; | ||
664 | goto failed; | ||
665 | } | ||
666 | hw = wlandev->priv; | ||
667 | |||
668 | /* Clear all the structs */ | ||
669 | memset(link, 0, sizeof(struct dev_link_t)); | ||
670 | |||
671 | if ( wlan_setup(wlandev) != 0 ) { | ||
672 | WLAN_LOG_ERROR("%s: wlan_setup() failed.\n", dev_info); | ||
673 | result = -EIO; | ||
674 | goto failed; | ||
675 | } | ||
676 | |||
677 | /* Initialize the hw struct for now */ | ||
678 | hfa384x_create(hw, 0, 0, NULL); | ||
679 | hw->wlandev = wlandev; | ||
680 | |||
681 | /* Initialize the PC card device object. */ | ||
682 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) | ||
683 | init_timer(&link->release); | ||
684 | link->release.function = &prism2sta_release; | ||
685 | link->release.data = (u_long)link; | ||
686 | #endif | ||
687 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
688 | link->priv = wlandev; | ||
689 | #if (defined(CS_RELEASE_CODE) && (CS_RELEASE_CODE < 0x2911)) | ||
690 | link->irq.Instance = wlandev; | ||
691 | #endif | ||
692 | |||
693 | /* Link in to the list of devices managed by this driver */ | ||
694 | link->next = dev_list; | ||
695 | dev_list = link; | ||
696 | |||
697 | /* Register with Card Services */ | ||
698 | client_reg.dev_info = &dev_info; | ||
699 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) ) | ||
700 | client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; | ||
701 | #endif | ||
702 | |||
703 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) ) | ||
704 | client_reg.EventMask = | ||
705 | CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | | ||
706 | CS_EVENT_RESET_REQUEST | | ||
707 | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | | ||
708 | CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; | ||
709 | client_reg.event_handler = &prism2sta_event; | ||
710 | #endif | ||
711 | |||
712 | client_reg.Version = 0x0210; | ||
713 | client_reg.event_callback_args.client_data = link; | ||
714 | |||
715 | result = pcmcia_register_client(&link->handle, &client_reg); | ||
716 | if (result != 0) { | ||
717 | cs_error(link->handle, RegisterClient, result); | ||
718 | prism2sta_detach(link); | ||
719 | return NULL; | ||
720 | } | ||
721 | |||
722 | goto done; | ||
723 | |||
724 | failed: | ||
725 | if (link) kfree(link); | ||
726 | if (wlandev) kfree(wlandev); | ||
727 | if (hw) kfree(hw); | ||
728 | link = NULL; | ||
729 | |||
730 | done: | ||
731 | DBFEXIT; | ||
732 | return link; | ||
733 | } | ||
734 | |||
735 | |||
736 | /*---------------------------------------------------------------- | ||
737 | * prism2sta_detach | ||
738 | * | ||
739 | * Remove one of the device instances managed by this driver. | ||
740 | * Search the list for the given instance, | ||
741 | * check our flags for a waiting timer'd release call | ||
742 | * call release | ||
743 | * Deregister the instance with Card Services | ||
744 | * (netdevice) unregister the network device. | ||
745 | * unlink the instance from the list | ||
746 | * free the link, priv, and priv->priv memory | ||
747 | * Note: the dev_list variable is a driver scoped static used to | ||
748 | * maintain a list of device instances managed by this | ||
749 | * driver. | ||
750 | * | ||
751 | * Arguments: | ||
752 | * link ptr to the instance to detach | ||
753 | * | ||
754 | * Returns: | ||
755 | * nothing | ||
756 | * | ||
757 | * Side effects: | ||
758 | * the link structure is gone, the netdevice is gone | ||
759 | * | ||
760 | * Call context: | ||
761 | * Might be interrupt, don't block. | ||
762 | ----------------------------------------------------------------*/ | ||
763 | void prism2sta_detach(dev_link_t *link) | ||
764 | { | ||
765 | dev_link_t **linkp; | ||
766 | wlandevice_t *wlandev; | ||
767 | hfa384x_t *hw; | ||
768 | |||
769 | DBFENTER; | ||
770 | |||
771 | /* Locate prev device structure */ | ||
772 | for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next) { | ||
773 | if (*linkp == link) break; | ||
774 | } | ||
775 | |||
776 | if (*linkp != NULL) { | ||
777 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) | ||
778 | unsigned long flags; | ||
779 | /* Get rid of any timer'd release call */ | ||
780 | save_flags(flags); | ||
781 | cli(); | ||
782 | #endif | ||
783 | |||
784 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) | ||
785 | if (link->state & DEV_RELEASE_PENDING) { | ||
786 | del_timer_sync(&link->release); | ||
787 | link->state &= ~DEV_RELEASE_PENDING; | ||
788 | } | ||
789 | #endif | ||
790 | |||
791 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) | ||
792 | restore_flags(flags); | ||
793 | #endif | ||
794 | |||
795 | /* If link says we're still config'd, call release */ | ||
796 | if (link->state & DEV_CONFIG) { | ||
797 | prism2sta_release((u_long)link); | ||
798 | if (link->state & DEV_STALE_CONFIG) { | ||
799 | link->state |= DEV_STALE_LINK; | ||
800 | return; | ||
801 | } | ||
802 | } | ||
803 | |||
804 | /* Tell Card Services we're not around any more */ | ||
805 | if (link->handle) { | ||
806 | pcmcia_deregister_client(link->handle); | ||
807 | } | ||
808 | |||
809 | /* Unlink device structure, free bits */ | ||
810 | *linkp = link->next; | ||
811 | if ( link->priv != NULL ) { | ||
812 | wlandev = (wlandevice_t*)link->priv; | ||
813 | p80211netdev_hwremoved(wlandev); | ||
814 | if (link->dev != NULL) { | ||
815 | unregister_wlandev(wlandev); | ||
816 | } | ||
817 | wlan_unsetup(wlandev); | ||
818 | if (wlandev->priv) { | ||
819 | hw = wlandev->priv; | ||
820 | wlandev->priv = NULL; | ||
821 | if (hw) { | ||
822 | hfa384x_destroy(hw); | ||
823 | kfree(hw); | ||
824 | } | ||
825 | } | ||
826 | link->priv = NULL; | ||
827 | kfree(wlandev); | ||
828 | } | ||
829 | kfree(link); | ||
830 | } | ||
831 | |||
832 | DBFEXIT; | ||
833 | return; | ||
834 | } | ||
835 | |||
836 | /*---------------------------------------------------------------- | ||
837 | * prism2sta_config | ||
838 | * | ||
839 | * Half of the config/release pair. Usually called in response to | ||
840 | * a card insertion event. At this point, we _know_ there's some | ||
841 | * physical device present. That means we can start poking around | ||
842 | * at the CIS and at any device specific config data we want. | ||
843 | * | ||
844 | * Note the gotos and the macros. I recoded this once without | ||
845 | * them, and it got incredibly ugly. It's actually simpler with | ||
846 | * them. | ||
847 | * | ||
848 | * Arguments: | ||
849 | * link the dev_link_t structure created in attach that | ||
850 | * represents this device instance. | ||
851 | * | ||
852 | * Returns: | ||
853 | * nothing | ||
854 | * | ||
855 | * Side effects: | ||
856 | * Resources (irq, io, mem) are allocated | ||
857 | * The pcmcia dev_link->node->name is set | ||
858 | * (For netcards) The device structure is finished and, | ||
859 | * most importantly, registered. This means that there | ||
860 | * is now a _named_ device that can be configured from | ||
861 | * userland. | ||
862 | * | ||
863 | * Call context: | ||
864 | * May be called from a timer. Don't block! | ||
865 | ----------------------------------------------------------------*/ | ||
866 | #define CS_CHECK(fn, ret) \ | ||
867 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
868 | |||
869 | #define CFG_CHECK(fn, retf) \ | ||
870 | do { int ret = (retf); \ | ||
871 | if (ret != 0) { \ | ||
872 | WLAN_LOG_DEBUG(1, "CardServices(" #fn ") returned %d\n", ret); \ | ||
873 | cs_error(link->handle, fn, ret); \ | ||
874 | goto next_entry; \ | ||
875 | } \ | ||
876 | } while (0) | ||
877 | |||
878 | void prism2sta_config(dev_link_t *link) | ||
879 | { | ||
880 | client_handle_t handle; | ||
881 | wlandevice_t *wlandev; | ||
882 | hfa384x_t *hw; | ||
883 | int last_fn; | ||
884 | int last_ret; | ||
885 | tuple_t tuple; | ||
886 | cisparse_t parse; | ||
887 | config_info_t socketconf; | ||
888 | UINT8 buf[64]; | ||
889 | int minVcc = 0; | ||
890 | int maxVcc = 0; | ||
891 | cistpl_cftable_entry_t dflt = { 0 }; | ||
892 | |||
893 | DBFENTER; | ||
894 | |||
895 | handle = link->handle; | ||
896 | wlandev = (wlandevice_t*)link->priv; | ||
897 | hw = wlandev->priv; | ||
898 | |||
899 | /* Collect the config register info */ | ||
900 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
901 | tuple.Attributes = 0; | ||
902 | tuple.TupleData = buf; | ||
903 | tuple.TupleDataMax = sizeof(buf); | ||
904 | tuple.TupleOffset = 0; | ||
905 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | ||
906 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
907 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
908 | |||
909 | link->conf.ConfigBase = parse.config.base; | ||
910 | link->conf.Present = parse.config.rmask[0]; | ||
911 | |||
912 | /* Configure card */ | ||
913 | link->state |= DEV_CONFIG; | ||
914 | |||
915 | /* Acquire the current socket config (need Vcc setting) */ | ||
916 | CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(handle, &socketconf)); | ||
917 | |||
918 | /* Loop through the config table entries until we find one that works */ | ||
919 | /* Assumes a complete and valid CIS */ | ||
920 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
921 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple)); | ||
922 | while (1) { | ||
923 | cistpl_cftable_entry_t *cfg = &(parse.cftable_entry); | ||
924 | CFG_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple)); | ||
925 | CFG_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse)); | ||
926 | |||
927 | if (cfg->index == 0) goto next_entry; | ||
928 | link->conf.ConfigIndex = cfg->index; | ||
929 | |||
930 | /* Lets print out the Vcc that the controller+pcmcia-cs set | ||
931 | * for us, cause that's what we're going to use. | ||
932 | */ | ||
933 | WLAN_LOG_DEBUG(1,"Initial Vcc=%d/10v\n", socketconf.Vcc); | ||
934 | if (prism2_ignorevcc) { | ||
935 | link->conf.Vcc = socketconf.Vcc; | ||
936 | goto skipvcc; | ||
937 | } | ||
938 | |||
939 | /* Use power settings for Vcc and Vpp if present */ | ||
940 | /* Note that the CIS values need to be rescaled */ | ||
941 | if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { | ||
942 | WLAN_LOG_DEBUG(1, "Vcc obtained from curtupl.VNOM\n"); | ||
943 | minVcc = maxVcc = | ||
944 | cfg->vcc.param[CISTPL_POWER_VNOM]/10000; | ||
945 | } else if (dflt.vcc.present & (1<<CISTPL_POWER_VNOM)) { | ||
946 | WLAN_LOG_DEBUG(1, "Vcc set from dflt.VNOM\n"); | ||
947 | minVcc = maxVcc = | ||
948 | dflt.vcc.param[CISTPL_POWER_VNOM]/10000; | ||
949 | } else if ((cfg->vcc.present & (1<<CISTPL_POWER_VMAX)) && | ||
950 | (cfg->vcc.present & (1<<CISTPL_POWER_VMIN)) ) { | ||
951 | WLAN_LOG_DEBUG(1, "Vcc set from curtupl(VMIN,VMAX)\n"); minVcc = cfg->vcc.param[CISTPL_POWER_VMIN]/10000; | ||
952 | maxVcc = cfg->vcc.param[CISTPL_POWER_VMAX]/10000; | ||
953 | } else if ((dflt.vcc.present & (1<<CISTPL_POWER_VMAX)) && | ||
954 | (dflt.vcc.present & (1<<CISTPL_POWER_VMIN)) ) { | ||
955 | WLAN_LOG_DEBUG(1, "Vcc set from dflt(VMIN,VMAX)\n"); | ||
956 | minVcc = dflt.vcc.param[CISTPL_POWER_VMIN]/10000; | ||
957 | maxVcc = dflt.vcc.param[CISTPL_POWER_VMAX]/10000; | ||
958 | } | ||
959 | |||
960 | if ( socketconf.Vcc >= minVcc && socketconf.Vcc <= maxVcc) { | ||
961 | link->conf.Vcc = socketconf.Vcc; | ||
962 | } else { | ||
963 | /* [MSM]: Note that I've given up trying to change | ||
964 | * the Vcc if a change is indicated. It seems the | ||
965 | * system&socketcontroller&card vendors can't seem | ||
966 | * to get it right, so I'm tired of trying to hack | ||
967 | * my way around it. pcmcia-cs does its best using | ||
968 | * the voltage sense pins but sometimes the controller | ||
969 | * lies. Then, even if we have a good read on the VS | ||
970 | * pins, some system designs will silently ignore our | ||
971 | * requests to set the voltage. Additionally, some | ||
972 | * vendors have 3.3v indicated on their sense pins, | ||
973 | * but 5v specified in the CIS or vice-versa. I've | ||
974 | * had it. My only recommendation is "let the buyer | ||
975 | * beware". Your system might supply 5v to a 3v card | ||
976 | * (possibly causing damage) or a 3v capable system | ||
977 | * might supply 5v to a 3v capable card (wasting | ||
978 | * precious battery life). | ||
979 | * My only recommendation (if you care) is to get | ||
980 | * yourself an extender card (I don't know where, I | ||
981 | * have only one myself) and a meter and test it for | ||
982 | * yourself. | ||
983 | */ | ||
984 | goto next_entry; | ||
985 | } | ||
986 | skipvcc: | ||
987 | WLAN_LOG_DEBUG(1, "link->conf.Vcc=%d\n", link->conf.Vcc); | ||
988 | |||
989 | /* Do we need to allocate an interrupt? */ | ||
990 | /* HACK: due to a bad CIS....we ALWAYS need an interrupt */ | ||
991 | /* if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) */ | ||
992 | link->conf.Attributes |= CONF_ENABLE_IRQ; | ||
993 | |||
994 | /* IO window settings */ | ||
995 | link->io.NumPorts1 = link->io.NumPorts2 = 0; | ||
996 | if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) { | ||
997 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io; | ||
998 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
999 | if (!(io->flags & CISTPL_IO_8BIT)) | ||
1000 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | ||
1001 | if (!(io->flags & CISTPL_IO_16BIT)) | ||
1002 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | ||
1003 | link->io.BasePort1 = io->win[0].base; | ||
1004 | if ( link->io.BasePort1 != 0 ) { | ||
1005 | WLAN_LOG_WARNING( | ||
1006 | "Brain damaged CIS: hard coded iobase=" | ||
1007 | "0x%x, try letting pcmcia_cs decide...\n", | ||
1008 | link->io.BasePort1 ); | ||
1009 | link->io.BasePort1 = 0; | ||
1010 | } | ||
1011 | link->io.NumPorts1 = io->win[0].len; | ||
1012 | if (io->nwin > 1) { | ||
1013 | link->io.Attributes2 = link->io.Attributes1; | ||
1014 | link->io.BasePort2 = io->win[1].base; | ||
1015 | link->io.NumPorts2 = io->win[1].len; | ||
1016 | } | ||
1017 | } | ||
1018 | |||
1019 | /* This reserves IO space but doesn't actually enable it */ | ||
1020 | CFG_CHECK(RequestIO, pcmcia_request_io(link->handle, &link->io)); | ||
1021 | |||
1022 | /* If we got this far, we're cool! */ | ||
1023 | break; | ||
1024 | |||
1025 | next_entry: | ||
1026 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | ||
1027 | dflt = *cfg; | ||
1028 | CS_CHECK(GetNextTuple, | ||
1029 | pcmcia_get_next_tuple(handle, &tuple)); | ||
1030 | } | ||
1031 | |||
1032 | /* Allocate an interrupt line. Note that this does not assign a */ | ||
1033 | /* handler to the interrupt, unless the 'Handler' member of the */ | ||
1034 | /* irq structure is initialized. */ | ||
1035 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
1036 | { | ||
1037 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) ) | ||
1038 | int i; | ||
1039 | link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID; | ||
1040 | if (irq_list[0] == -1) | ||
1041 | link->irq.IRQInfo2 = irq_mask; | ||
1042 | else | ||
1043 | for (i=0; i<4; i++) | ||
1044 | link->irq.IRQInfo2 |= 1 << irq_list[i]; | ||
1045 | #else | ||
1046 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
1047 | #endif | ||
1048 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | ||
1049 | link->irq.Handler = hfa384x_interrupt; | ||
1050 | link->irq.Instance = wlandev; | ||
1051 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq)); | ||
1052 | } | ||
1053 | |||
1054 | /* This actually configures the PCMCIA socket -- setting up */ | ||
1055 | /* the I/O windows and the interrupt mapping, and putting the */ | ||
1056 | /* card and host interface into "Memory and IO" mode. */ | ||
1057 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link->handle, &link->conf)); | ||
1058 | |||
1059 | /* Fill the netdevice with this info */ | ||
1060 | wlandev->netdev->irq = link->irq.AssignedIRQ; | ||
1061 | wlandev->netdev->base_addr = link->io.BasePort1; | ||
1062 | |||
1063 | /* Report what we've done */ | ||
1064 | WLAN_LOG_INFO("%s: index 0x%02x: Vcc %d.%d", | ||
1065 | dev_info, link->conf.ConfigIndex, | ||
1066 | link->conf.Vcc/10, link->conf.Vcc%10); | ||
1067 | if (link->conf.Vpp1) | ||
1068 | printk(", Vpp %d.%d", link->conf.Vpp1/10, link->conf.Vpp1%10); | ||
1069 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
1070 | printk(", irq %d", link->irq.AssignedIRQ); | ||
1071 | if (link->io.NumPorts1) | ||
1072 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, link->io.BasePort1+link->io.NumPorts1-1); | ||
1073 | if (link->io.NumPorts2) | ||
1074 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, link->io.BasePort2+link->io.NumPorts2-1); | ||
1075 | printk("\n"); | ||
1076 | |||
1077 | link->state &= ~DEV_CONFIG_PENDING; | ||
1078 | |||
1079 | /* Let pcmcia know the device name */ | ||
1080 | link->dev = &hw->node; | ||
1081 | |||
1082 | /* Register the network device and get assigned a name */ | ||
1083 | SET_MODULE_OWNER(wlandev->netdev); | ||
1084 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) ) | ||
1085 | SET_NETDEV_DEV(wlandev->netdev, &handle_to_dev(link->handle)); | ||
1086 | #endif | ||
1087 | if (register_wlandev(wlandev) != 0) { | ||
1088 | WLAN_LOG_NOTICE("prism2sta_cs: register_wlandev() failed.\n"); | ||
1089 | goto failed; | ||
1090 | } | ||
1091 | |||
1092 | strcpy(hw->node.dev_name, wlandev->name); | ||
1093 | |||
1094 | /* Any device custom config/query stuff should be done here */ | ||
1095 | /* For a netdevice, we should at least grab the mac address */ | ||
1096 | |||
1097 | return; | ||
1098 | cs_failed: | ||
1099 | cs_error(link->handle, last_fn, last_ret); | ||
1100 | WLAN_LOG_ERROR("NextTuple failure? It's probably a Vcc mismatch.\n"); | ||
1101 | |||
1102 | failed: | ||
1103 | prism2sta_release((u_long)link); | ||
1104 | return; | ||
1105 | } | ||
1106 | |||
1107 | /*---------------------------------------------------------------- | ||
1108 | * prism2sta_release | ||
1109 | * | ||
1110 | * Half of the config/release pair. Usually called in response to | ||
1111 | * a card ejection event. Checks to make sure no higher layers | ||
1112 | * are still (or think they are) using the card via the link->open | ||
1113 | * field. | ||
1114 | * | ||
1115 | * NOTE: Don't forget to increment the link->open variable in the | ||
1116 | * device_open method, and decrement it in the device_close | ||
1117 | * method. | ||
1118 | * | ||
1119 | * Arguments: | ||
1120 | * arg a generic 32 bit variable. It's the value that | ||
1121 | * we assigned to link->release.data in sta_attach(). | ||
1122 | * | ||
1123 | * Returns: | ||
1124 | * nothing | ||
1125 | * | ||
1126 | * Side effects: | ||
1127 | * All resources should be released after this function | ||
1128 | * executes and finds the device !open. | ||
1129 | * | ||
1130 | * Call context: | ||
1131 | * Possibly in a timer context. Don't do anything that'll | ||
1132 | * block. | ||
1133 | ----------------------------------------------------------------*/ | ||
1134 | void prism2sta_release(u_long arg) | ||
1135 | { | ||
1136 | dev_link_t *link = (dev_link_t *)arg; | ||
1137 | |||
1138 | DBFENTER; | ||
1139 | |||
1140 | /* First thing we should do is get the MSD back to the | ||
1141 | * HWPRESENT state. I.e. everything quiescent. | ||
1142 | */ | ||
1143 | prism2sta_ifstate(link->priv, P80211ENUM_ifstate_disable); | ||
1144 | |||
1145 | if (link->open) { | ||
1146 | /* TODO: I don't think we're even using this bit of code | ||
1147 | * and I don't think it's hurting us at the moment. | ||
1148 | */ | ||
1149 | WLAN_LOG_DEBUG(1, | ||
1150 | "prism2sta_cs: release postponed, '%s' still open\n", | ||
1151 | link->dev->dev_name); | ||
1152 | link->state |= DEV_STALE_CONFIG; | ||
1153 | return; | ||
1154 | } | ||
1155 | |||
1156 | pcmcia_release_configuration(link->handle); | ||
1157 | pcmcia_release_io(link->handle, &link->io); | ||
1158 | pcmcia_release_irq(link->handle, &link->irq); | ||
1159 | |||
1160 | link->state &= ~(DEV_CONFIG | DEV_RELEASE_PENDING); | ||
1161 | |||
1162 | DBFEXIT; | ||
1163 | } | ||
1164 | |||
1165 | /*---------------------------------------------------------------- | ||
1166 | * prism2sta_event | ||
1167 | * | ||
1168 | * Handler for card services events. | ||
1169 | * | ||
1170 | * Arguments: | ||
1171 | * event The event code | ||
1172 | * priority hi/low - REMOVAL is the only hi | ||
1173 | * args ptr to card services struct containing info about | ||
1174 | * pcmcia status | ||
1175 | * | ||
1176 | * Returns: | ||
1177 | * Zero on success, non-zero otherwise | ||
1178 | * | ||
1179 | * Side effects: | ||
1180 | * | ||
1181 | * | ||
1182 | * Call context: | ||
1183 | * Both interrupt and process thread, depends on the event. | ||
1184 | ----------------------------------------------------------------*/ | ||
1185 | static int | ||
1186 | prism2sta_event ( | ||
1187 | event_t event, | ||
1188 | int priority, | ||
1189 | event_callback_args_t *args) | ||
1190 | { | ||
1191 | int result = 0; | ||
1192 | dev_link_t *link = (dev_link_t *) args->client_data; | ||
1193 | wlandevice_t *wlandev = (wlandevice_t*)link->priv; | ||
1194 | hfa384x_t *hw = NULL; | ||
1195 | |||
1196 | DBFENTER; | ||
1197 | |||
1198 | if (wlandev) hw = wlandev->priv; | ||
1199 | |||
1200 | switch (event) | ||
1201 | { | ||
1202 | case CS_EVENT_CARD_INSERTION: | ||
1203 | WLAN_LOG_DEBUG(5,"event is INSERTION\n"); | ||
1204 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | ||
1205 | prism2sta_config(link); | ||
1206 | if (!(link->state & DEV_CONFIG)) { | ||
1207 | wlandev->netdev->irq = 0; | ||
1208 | WLAN_LOG_ERROR( | ||
1209 | "%s: Initialization failed!\n", dev_info); | ||
1210 | wlandev->msdstate = WLAN_MSD_HWFAIL; | ||
1211 | break; | ||
1212 | } | ||
1213 | |||
1214 | /* Fill in the rest of the hw struct */ | ||
1215 | hw->irq = wlandev->netdev->irq; | ||
1216 | hw->iobase = wlandev->netdev->base_addr; | ||
1217 | hw->link = link; | ||
1218 | |||
1219 | if (prism2_doreset) { | ||
1220 | result = hfa384x_corereset(hw, | ||
1221 | prism2_reset_holdtime, | ||
1222 | prism2_reset_settletime, 0); | ||
1223 | if ( result ) { | ||
1224 | WLAN_LOG_ERROR( | ||
1225 | "corereset() failed, result=%d.\n", | ||
1226 | result); | ||
1227 | wlandev->msdstate = WLAN_MSD_HWFAIL; | ||
1228 | break; | ||
1229 | } | ||
1230 | } | ||
1231 | |||
1232 | #if 0 | ||
1233 | /* | ||
1234 | * TODO: test_hostif() not implemented yet. | ||
1235 | */ | ||
1236 | result = hfa384x_test_hostif(hw); | ||
1237 | if (result) { | ||
1238 | WLAN_LOG_ERROR( | ||
1239 | "test_hostif() failed, result=%d.\n", result); | ||
1240 | wlandev->msdstate = WLAN_MSD_HWFAIL; | ||
1241 | break; | ||
1242 | } | ||
1243 | #endif | ||
1244 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
1245 | break; | ||
1246 | |||
1247 | case CS_EVENT_CARD_REMOVAL: | ||
1248 | WLAN_LOG_DEBUG(5,"event is REMOVAL\n"); | ||
1249 | link->state &= ~DEV_PRESENT; | ||
1250 | |||
1251 | if (wlandev) { | ||
1252 | p80211netdev_hwremoved(wlandev); | ||
1253 | } | ||
1254 | |||
1255 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) | ||
1256 | if (link->state & DEV_CONFIG) | ||
1257 | { | ||
1258 | link->release.expires = jiffies + (HZ/20); | ||
1259 | add_timer(&link->release); | ||
1260 | } | ||
1261 | #endif | ||
1262 | break; | ||
1263 | case CS_EVENT_RESET_REQUEST: | ||
1264 | WLAN_LOG_DEBUG(5,"event is RESET_REQUEST\n"); | ||
1265 | WLAN_LOG_NOTICE( | ||
1266 | "prism2 card reset not supported " | ||
1267 | "due to post-reset user mode configuration " | ||
1268 | "requirements.\n"); | ||
1269 | WLAN_LOG_NOTICE( | ||
1270 | " From user mode, use " | ||
1271 | "'cardctl suspend;cardctl resume' " | ||
1272 | "instead.\n"); | ||
1273 | break; | ||
1274 | case CS_EVENT_RESET_PHYSICAL: | ||
1275 | case CS_EVENT_CARD_RESET: | ||
1276 | WLAN_LOG_WARNING("Rx'd CS_EVENT_RESET_xxx, should not " | ||
1277 | "be possible since RESET_REQUEST was denied.\n"); | ||
1278 | break; | ||
1279 | |||
1280 | case CS_EVENT_PM_SUSPEND: | ||
1281 | WLAN_LOG_DEBUG(5,"event is SUSPEND\n"); | ||
1282 | link->state |= DEV_SUSPEND; | ||
1283 | if (link->state & DEV_CONFIG) | ||
1284 | { | ||
1285 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
1286 | pcmcia_release_configuration(link->handle); | ||
1287 | } | ||
1288 | break; | ||
1289 | |||
1290 | case CS_EVENT_PM_RESUME: | ||
1291 | WLAN_LOG_DEBUG(5,"event is RESUME\n"); | ||
1292 | link->state &= ~DEV_SUSPEND; | ||
1293 | if (link->state & DEV_CONFIG) { | ||
1294 | pcmcia_request_configuration(link->handle, &link->conf); | ||
1295 | } | ||
1296 | break; | ||
1297 | } | ||
1298 | |||
1299 | DBFEXIT; | ||
1300 | return 0; /* noone else does anthing with the return value */ | ||
1301 | } | ||
1302 | #endif // <= 2.6.15 | ||
1303 | |||
1304 | |||
1305 | |||
1306 | int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis) | ||
1307 | { | ||
1308 | int result = 0; | ||
1309 | conf_reg_t reg; | ||
1310 | UINT8 corsave; | ||
1311 | DBFENTER; | ||
1312 | |||
1313 | WLAN_LOG_DEBUG(3, "Doing reset via CardServices().\n"); | ||
1314 | |||
1315 | /* Collect COR */ | ||
1316 | reg.Function = 0; | ||
1317 | reg.Action = CS_READ; | ||
1318 | reg.Offset = CISREG_COR; | ||
1319 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
1320 | result = pcmcia_access_configuration_register(hw->pdev, ®); | ||
1321 | #else | ||
1322 | result = pcmcia_access_configuration_register( | ||
1323 | hw->link->handle, | ||
1324 | ®); | ||
1325 | #endif | ||
1326 | if (result != CS_SUCCESS ) { | ||
1327 | WLAN_LOG_ERROR( | ||
1328 | ":0: AccessConfigurationRegister(CS_READ) failed," | ||
1329 | "result=%d.\n", result); | ||
1330 | result = -EIO; | ||
1331 | } | ||
1332 | corsave = reg.Value; | ||
1333 | |||
1334 | /* Write reset bit (BIT7) */ | ||
1335 | reg.Value |= BIT7; | ||
1336 | reg.Action = CS_WRITE; | ||
1337 | reg.Offset = CISREG_COR; | ||
1338 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
1339 | result = pcmcia_access_configuration_register(hw->pdev, ®); | ||
1340 | #else | ||
1341 | result = pcmcia_access_configuration_register( | ||
1342 | hw->link->handle, | ||
1343 | ®); | ||
1344 | #endif | ||
1345 | if (result != CS_SUCCESS ) { | ||
1346 | WLAN_LOG_ERROR( | ||
1347 | ":1: AccessConfigurationRegister(CS_WRITE) failed," | ||
1348 | "result=%d.\n", result); | ||
1349 | result = -EIO; | ||
1350 | } | ||
1351 | |||
1352 | /* Hold for holdtime */ | ||
1353 | mdelay(holdtime); | ||
1354 | |||
1355 | if (genesis) { | ||
1356 | reg.Value = genesis; | ||
1357 | reg.Action = CS_WRITE; | ||
1358 | reg.Offset = CISREG_CCSR; | ||
1359 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
1360 | result = pcmcia_access_configuration_register(hw->pdev, ®); | ||
1361 | #else | ||
1362 | result = pcmcia_access_configuration_register( | ||
1363 | hw->link->handle, | ||
1364 | ®); | ||
1365 | #endif | ||
1366 | if (result != CS_SUCCESS ) { | ||
1367 | WLAN_LOG_ERROR( | ||
1368 | ":1: AccessConfigurationRegister(CS_WRITE) failed," | ||
1369 | "result=%d.\n", result); | ||
1370 | result = -EIO; | ||
1371 | } | ||
1372 | } | ||
1373 | |||
1374 | /* Hold for holdtime */ | ||
1375 | mdelay(holdtime); | ||
1376 | |||
1377 | /* Clear reset bit */ | ||
1378 | reg.Value &= ~BIT7; | ||
1379 | reg.Action = CS_WRITE; | ||
1380 | reg.Offset = CISREG_COR; | ||
1381 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
1382 | result = pcmcia_access_configuration_register(hw->pdev, ®); | ||
1383 | #else | ||
1384 | result = pcmcia_access_configuration_register( | ||
1385 | hw->link->handle, | ||
1386 | ®); | ||
1387 | #endif | ||
1388 | if (result != CS_SUCCESS ) { | ||
1389 | WLAN_LOG_ERROR( | ||
1390 | ":2: AccessConfigurationRegister(CS_WRITE) failed," | ||
1391 | "result=%d.\n", result); | ||
1392 | result = -EIO; | ||
1393 | goto done; | ||
1394 | } | ||
1395 | |||
1396 | /* Wait for settletime */ | ||
1397 | mdelay(settletime); | ||
1398 | |||
1399 | /* Set non-reset bits back what they were */ | ||
1400 | reg.Value = corsave; | ||
1401 | reg.Action = CS_WRITE; | ||
1402 | reg.Offset = CISREG_COR; | ||
1403 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16) | ||
1404 | result = pcmcia_access_configuration_register(hw->pdev, ®); | ||
1405 | #else | ||
1406 | result = pcmcia_access_configuration_register( | ||
1407 | hw->link->handle, | ||
1408 | ®); | ||
1409 | #endif | ||
1410 | if (result != CS_SUCCESS ) { | ||
1411 | WLAN_LOG_ERROR( | ||
1412 | ":2: AccessConfigurationRegister(CS_WRITE) failed," | ||
1413 | "result=%d.\n", result); | ||
1414 | result = -EIO; | ||
1415 | goto done; | ||
1416 | } | ||
1417 | |||
1418 | done: | ||
1419 | DBFEXIT; | ||
1420 | return result; | ||
1421 | } | ||
1422 | |||
1423 | #ifdef MODULE | ||
1424 | |||
1425 | static int __init prism2cs_init(void) | ||
1426 | { | ||
1427 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) | ||
1428 | servinfo_t serv; | ||
1429 | #endif | ||
1430 | |||
1431 | DBFENTER; | ||
1432 | |||
1433 | WLAN_LOG_NOTICE("%s Loaded\n", version); | ||
1434 | WLAN_LOG_NOTICE("dev_info is: %s\n", dev_info); | ||
1435 | |||
1436 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) | ||
1437 | pcmcia_get_card_services_info(&serv); | ||
1438 | if ( serv.Revision != CS_RELEASE_CODE ) | ||
1439 | { | ||
1440 | printk(KERN_NOTICE"%s: CardServices release does not match!\n", dev_info); | ||
1441 | return -1; | ||
1442 | } | ||
1443 | |||
1444 | /* This call will result in a call to prism2sta_attach */ | ||
1445 | /* and eventually prism2sta_detach */ | ||
1446 | register_pccard_driver( &dev_info, &prism2sta_attach, &prism2sta_detach); | ||
1447 | #else | ||
1448 | pcmcia_register_driver(&prism2_cs_driver); | ||
1449 | #endif | ||
1450 | |||
1451 | DBFEXIT; | ||
1452 | return 0; | ||
1453 | } | ||
1454 | |||
1455 | static void __exit prism2cs_cleanup(void) | ||
1456 | { | ||
1457 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) | ||
1458 | dev_link_t *link = dev_list; | ||
1459 | dev_link_t *nlink; | ||
1460 | DBFENTER; | ||
1461 | |||
1462 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) | ||
1463 | for (link=dev_list; link != NULL; link = nlink) { | ||
1464 | nlink = link->next; | ||
1465 | if ( link->state & DEV_CONFIG ) { | ||
1466 | prism2sta_release((u_long)link); | ||
1467 | } | ||
1468 | prism2sta_detach(link); /* remember detach() frees link */ | ||
1469 | } | ||
1470 | #endif | ||
1471 | |||
1472 | unregister_pccard_driver( &dev_info); | ||
1473 | #else | ||
1474 | pcmcia_unregister_driver(&prism2_cs_driver); | ||
1475 | #endif | ||
1476 | |||
1477 | printk(KERN_NOTICE "%s Unloaded\n", version); | ||
1478 | |||
1479 | DBFEXIT; | ||
1480 | return; | ||
1481 | } | ||
1482 | |||
1483 | module_init(prism2cs_init); | ||
1484 | module_exit(prism2cs_cleanup); | ||
1485 | |||
1486 | #endif // MODULE | ||
1487 | |||
diff --git a/drivers/staging/wlan-ng/prism2_pci.c b/drivers/staging/wlan-ng/prism2_pci.c new file mode 100644 index 000000000000..afe32dfbf6b1 --- /dev/null +++ b/drivers/staging/wlan-ng/prism2_pci.c | |||
@@ -0,0 +1,332 @@ | |||
1 | #define WLAN_HOSTIF WLAN_PCI | ||
2 | #include "hfa384x.c" | ||
3 | #include "prism2mgmt.c" | ||
4 | #include "prism2mib.c" | ||
5 | #include "prism2sta.c" | ||
6 | |||
7 | #define PCI_SIZE 0x1000 /* Memory size - 4K bytes */ | ||
8 | |||
9 | /* ISL3874A 11Mb/s WLAN controller */ | ||
10 | #define PCIVENDOR_INTERSIL 0x1260UL | ||
11 | #define PCIDEVICE_ISL3874 0x3873UL /* [MSM] yeah I know...the ID says | ||
12 | 3873. Trust me, it's a 3874. */ | ||
13 | |||
14 | /* Samsung SWL-2210P 11Mb/s WLAN controller (uses ISL3874A) */ | ||
15 | #define PCIVENDOR_SAMSUNG 0x167dUL | ||
16 | #define PCIDEVICE_SWL_2210P 0xa000UL | ||
17 | |||
18 | #define PCIVENDOR_NETGEAR 0x1385UL /* for MA311 */ | ||
19 | |||
20 | /* PCI Class & Sub-Class code, Network-'Other controller' */ | ||
21 | #define PCI_CLASS_NETWORK_OTHERS 0x280 | ||
22 | |||
23 | |||
24 | /*---------------------------------------------------------------- | ||
25 | * prism2sta_probe_pci | ||
26 | * | ||
27 | * Probe routine called when a PCI device w/ matching ID is found. | ||
28 | * The ISL3874 implementation uses the following map: | ||
29 | * BAR0: Prism2.x registers memory mapped, size=4k | ||
30 | * Here's the sequence: | ||
31 | * - Allocate the PCI resources. | ||
32 | * - Read the PCMCIA attribute memory to make sure we have a WLAN card | ||
33 | * - Reset the MAC | ||
34 | * - Initialize the netdev and wlan data | ||
35 | * - Initialize the MAC | ||
36 | * | ||
37 | * Arguments: | ||
38 | * pdev ptr to pci device structure containing info about | ||
39 | * pci configuration. | ||
40 | * id ptr to the device id entry that matched this device. | ||
41 | * | ||
42 | * Returns: | ||
43 | * zero - success | ||
44 | * negative - failed | ||
45 | * | ||
46 | * Side effects: | ||
47 | * | ||
48 | * | ||
49 | * Call context: | ||
50 | * process thread | ||
51 | * | ||
52 | ----------------------------------------------------------------*/ | ||
53 | static int __devinit | ||
54 | prism2sta_probe_pci( | ||
55 | struct pci_dev *pdev, | ||
56 | const struct pci_device_id *id) | ||
57 | { | ||
58 | int result; | ||
59 | phys_t phymem = 0; | ||
60 | void __iomem *mem = NULL; | ||
61 | wlandevice_t *wlandev = NULL; | ||
62 | hfa384x_t *hw = NULL; | ||
63 | |||
64 | DBFENTER; | ||
65 | |||
66 | /* Enable the pci device */ | ||
67 | if (pci_enable_device(pdev)) { | ||
68 | WLAN_LOG_ERROR("%s: pci_enable_device() failed.\n", dev_info); | ||
69 | result = -EIO; | ||
70 | goto fail; | ||
71 | } | ||
72 | |||
73 | /* Figure out our resources */ | ||
74 | phymem = pci_resource_start(pdev, 0); | ||
75 | |||
76 | if (!request_mem_region(phymem, pci_resource_len(pdev, 0), "Prism2")) { | ||
77 | printk(KERN_ERR "prism2: Cannot reserve PCI memory region\n"); | ||
78 | result = -EIO; | ||
79 | goto fail; | ||
80 | } | ||
81 | |||
82 | mem = ioremap(phymem, PCI_SIZE); | ||
83 | if ( mem == 0 ) { | ||
84 | WLAN_LOG_ERROR("%s: ioremap() failed.\n", dev_info); | ||
85 | result = -EIO; | ||
86 | goto fail; | ||
87 | } | ||
88 | |||
89 | /* Log the device */ | ||
90 | WLAN_LOG_INFO("A Prism2.5 PCI device found, " | ||
91 | "phymem:0x%llx, irq:%d, mem:0x%p\n", | ||
92 | (unsigned long long)phymem, pdev->irq, mem); | ||
93 | |||
94 | if ((wlandev = create_wlan()) == NULL) { | ||
95 | WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info); | ||
96 | result = -EIO; | ||
97 | goto fail; | ||
98 | } | ||
99 | hw = wlandev->priv; | ||
100 | |||
101 | if ( wlan_setup(wlandev) != 0 ) { | ||
102 | WLAN_LOG_ERROR("%s: wlan_setup() failed.\n", dev_info); | ||
103 | result = -EIO; | ||
104 | goto fail; | ||
105 | } | ||
106 | |||
107 | /* Setup netdevice's ability to report resources | ||
108 | * Note: the netdevice was allocated by wlan_setup() | ||
109 | */ | ||
110 | wlandev->netdev->irq = pdev->irq; | ||
111 | wlandev->netdev->mem_start = (unsigned long) mem; | ||
112 | wlandev->netdev->mem_end = wlandev->netdev->mem_start + | ||
113 | pci_resource_len(pdev, 0); | ||
114 | |||
115 | /* Initialize the hw data */ | ||
116 | hfa384x_create(hw, wlandev->netdev->irq, 0, mem); | ||
117 | hw->wlandev = wlandev; | ||
118 | |||
119 | /* Register the wlandev, this gets us a name and registers the | ||
120 | * linux netdevice. | ||
121 | */ | ||
122 | SET_MODULE_OWNER(wlandev->netdev); | ||
123 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) | ||
124 | SET_NETDEV_DEV(wlandev->netdev, &(pdev->dev)); | ||
125 | #endif | ||
126 | if ( register_wlandev(wlandev) != 0 ) { | ||
127 | WLAN_LOG_ERROR("%s: register_wlandev() failed.\n", dev_info); | ||
128 | result = -EIO; | ||
129 | goto fail; | ||
130 | } | ||
131 | |||
132 | #if 0 | ||
133 | /* TODO: Move this and an irq test into an hfa384x_testif() routine. | ||
134 | */ | ||
135 | outw(PRISM2STA_MAGIC, HFA384x_SWSUPPORT(wlandev->netdev->base_addr)); | ||
136 | reg=inw( HFA384x_SWSUPPORT(wlandev->netdev->base_addr)); | ||
137 | if ( reg != PRISM2STA_MAGIC ) { | ||
138 | WLAN_LOG_ERROR("MAC register access test failed!\n"); | ||
139 | result = -EIO; | ||
140 | goto fail; | ||
141 | } | ||
142 | #endif | ||
143 | |||
144 | /* Do a chip-level reset on the MAC */ | ||
145 | if (prism2_doreset) { | ||
146 | result = hfa384x_corereset(hw, | ||
147 | prism2_reset_holdtime, | ||
148 | prism2_reset_settletime, 0); | ||
149 | if (result != 0) { | ||
150 | WLAN_LOG_ERROR( | ||
151 | "%s: hfa384x_corereset() failed.\n", | ||
152 | dev_info); | ||
153 | unregister_wlandev(wlandev); | ||
154 | hfa384x_destroy(hw); | ||
155 | result = -EIO; | ||
156 | goto fail; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | pci_set_drvdata(pdev, wlandev); | ||
161 | |||
162 | /* Shouldn't actually hook up the IRQ until we | ||
163 | * _know_ things are alright. A test routine would help. | ||
164 | */ | ||
165 | request_irq(wlandev->netdev->irq, hfa384x_interrupt, | ||
166 | SA_SHIRQ, wlandev->name, wlandev); | ||
167 | |||
168 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
169 | |||
170 | result = 0; | ||
171 | goto done; | ||
172 | |||
173 | fail: | ||
174 | pci_set_drvdata(pdev, NULL); | ||
175 | if (wlandev) kfree(wlandev); | ||
176 | if (hw) kfree(hw); | ||
177 | if (mem) iounmap(mem); | ||
178 | pci_release_regions(pdev); | ||
179 | pci_disable_device(pdev); | ||
180 | |||
181 | done: | ||
182 | DBFEXIT; | ||
183 | return result; | ||
184 | } | ||
185 | |||
186 | static void __devexit prism2sta_remove_pci(struct pci_dev *pdev) | ||
187 | { | ||
188 | wlandevice_t *wlandev; | ||
189 | hfa384x_t *hw; | ||
190 | |||
191 | wlandev = (wlandevice_t *) pci_get_drvdata(pdev); | ||
192 | hw = wlandev->priv; | ||
193 | |||
194 | p80211netdev_hwremoved(wlandev); | ||
195 | |||
196 | /* reset hardware */ | ||
197 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
198 | |||
199 | if (pdev->irq) | ||
200 | free_irq(pdev->irq, wlandev); | ||
201 | |||
202 | unregister_wlandev(wlandev); | ||
203 | |||
204 | /* free local stuff */ | ||
205 | if (hw) { | ||
206 | hfa384x_destroy(hw); | ||
207 | kfree(hw); | ||
208 | } | ||
209 | |||
210 | iounmap((void __iomem *)wlandev->netdev->mem_start); | ||
211 | wlan_unsetup(wlandev); | ||
212 | |||
213 | pci_release_regions(pdev); | ||
214 | pci_disable_device(pdev); | ||
215 | pci_set_drvdata(pdev, NULL); | ||
216 | |||
217 | kfree(wlandev); | ||
218 | } | ||
219 | |||
220 | |||
221 | static struct pci_device_id pci_id_tbl[] = { | ||
222 | { | ||
223 | PCIVENDOR_INTERSIL, PCIDEVICE_ISL3874, | ||
224 | PCI_ANY_ID, PCI_ANY_ID, | ||
225 | 0, 0, | ||
226 | /* Driver data, we just put the name here */ | ||
227 | (unsigned long)"Intersil Prism2.5 ISL3874 11Mb/s WLAN Controller" | ||
228 | }, | ||
229 | { | ||
230 | PCIVENDOR_INTERSIL, 0x3872, | ||
231 | PCI_ANY_ID, PCI_ANY_ID, | ||
232 | 0, 0, | ||
233 | /* Driver data, we just put the name here */ | ||
234 | (unsigned long)"Intersil Prism2.5 ISL3872 11Mb/s WLAN Controller" | ||
235 | }, | ||
236 | { | ||
237 | PCIVENDOR_SAMSUNG, PCIDEVICE_SWL_2210P, | ||
238 | PCI_ANY_ID, PCI_ANY_ID, | ||
239 | 0, 0, | ||
240 | /* Driver data, we just put the name here */ | ||
241 | (unsigned long)"Samsung MagicLAN SWL-2210P 11Mb/s WLAN Controller" | ||
242 | }, | ||
243 | { /* for NetGear MA311 */ | ||
244 | PCIVENDOR_NETGEAR, 0x3872, | ||
245 | PCI_ANY_ID, PCI_ANY_ID, | ||
246 | 0, 0, | ||
247 | /* Driver data, we just put the name here */ | ||
248 | (unsigned long)"Netgear MA311 WLAN Controller" | ||
249 | }, | ||
250 | { | ||
251 | 0, 0, 0, 0, 0, 0, 0 | ||
252 | } | ||
253 | }; | ||
254 | |||
255 | MODULE_DEVICE_TABLE(pci, pci_id_tbl); | ||
256 | |||
257 | /* Function declared here because of ptr reference below */ | ||
258 | static int __devinit prism2sta_probe_pci(struct pci_dev *pdev, | ||
259 | const struct pci_device_id *id); | ||
260 | static void __devexit prism2sta_remove_pci(struct pci_dev *pdev); | ||
261 | |||
262 | static struct pci_driver prism2_pci_drv_id = { | ||
263 | .name = "prism2_pci", | ||
264 | .id_table = pci_id_tbl, | ||
265 | .probe = prism2sta_probe_pci, | ||
266 | .remove = prism2sta_remove_pci, | ||
267 | #ifdef CONFIG_PM | ||
268 | .suspend = prism2sta_suspend_pci, | ||
269 | .resume = prism2sta_resume_pci, | ||
270 | #endif | ||
271 | }; | ||
272 | |||
273 | #ifdef MODULE | ||
274 | |||
275 | static int __init prism2pci_init(void) | ||
276 | { | ||
277 | WLAN_LOG_NOTICE("%s Loaded\n", version); | ||
278 | return pci_module_init(&prism2_pci_drv_id); | ||
279 | }; | ||
280 | |||
281 | static void __exit prism2pci_cleanup(void) | ||
282 | { | ||
283 | pci_unregister_driver(&prism2_pci_drv_id); | ||
284 | }; | ||
285 | |||
286 | module_init(prism2pci_init); | ||
287 | module_exit(prism2pci_cleanup); | ||
288 | |||
289 | #endif | ||
290 | |||
291 | int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis) | ||
292 | { | ||
293 | int result = 0; | ||
294 | unsigned long timeout; | ||
295 | UINT16 reg; | ||
296 | DBFENTER; | ||
297 | |||
298 | /* Assert reset and wait awhile | ||
299 | * (note: these delays are _really_ long, but they appear to be | ||
300 | * necessary.) | ||
301 | */ | ||
302 | hfa384x_setreg(hw, 0xc5, HFA384x_PCICOR); | ||
303 | timeout = jiffies + HZ/4; | ||
304 | while(time_before(jiffies, timeout)) udelay(5); | ||
305 | |||
306 | if (genesis) { | ||
307 | hfa384x_setreg(hw, genesis, HFA384x_PCIHCR); | ||
308 | timeout = jiffies + HZ/4; | ||
309 | while(time_before(jiffies, timeout)) udelay(5); | ||
310 | } | ||
311 | |||
312 | /* Clear the reset and wait some more | ||
313 | */ | ||
314 | hfa384x_setreg(hw, 0x45, HFA384x_PCICOR); | ||
315 | timeout = jiffies + HZ/2; | ||
316 | while(time_before(jiffies, timeout)) udelay(5); | ||
317 | |||
318 | /* Wait for f/w to complete initialization (CMD:BUSY == 0) | ||
319 | */ | ||
320 | timeout = jiffies + 2*HZ; | ||
321 | reg = hfa384x_getreg(hw, HFA384x_CMD); | ||
322 | while ( HFA384x_CMD_ISBUSY(reg) && time_before( jiffies, timeout) ) { | ||
323 | reg = hfa384x_getreg(hw, HFA384x_CMD); | ||
324 | udelay(10); | ||
325 | } | ||
326 | if (HFA384x_CMD_ISBUSY(reg)) { | ||
327 | WLAN_LOG_WARNING("corereset: Timed out waiting for cmd register.\n"); | ||
328 | result=1; | ||
329 | } | ||
330 | DBFEXIT; | ||
331 | return result; | ||
332 | } | ||
diff --git a/drivers/staging/wlan-ng/prism2_plx.c b/drivers/staging/wlan-ng/prism2_plx.c new file mode 100644 index 000000000000..320443f37a8f --- /dev/null +++ b/drivers/staging/wlan-ng/prism2_plx.c | |||
@@ -0,0 +1,472 @@ | |||
1 | #define WLAN_HOSTIF WLAN_PLX | ||
2 | #include "hfa384x.c" | ||
3 | #include "prism2mgmt.c" | ||
4 | #include "prism2mib.c" | ||
5 | #include "prism2sta.c" | ||
6 | |||
7 | #define PLX_ATTR_SIZE 0x1000 /* Attribute memory size - 4K bytes */ | ||
8 | #define COR_OFFSET 0x3e0 /* COR attribute offset of Prism2 PC card */ | ||
9 | #define COR_VALUE 0x41 /* Enable PC card with irq in level trigger */ | ||
10 | #define PLX_INTCSR 0x4c /* Interrupt Control and Status Register */ | ||
11 | #define PLX_INTCSR_INTEN (1<<6) /* Interrupt Enable bit */ | ||
12 | #define PLX_MIN_ATTR_LEN 512 /* at least 2 x 256 is needed for CIS */ | ||
13 | |||
14 | /* 3Com 3CRW777A (PLX) board ID */ | ||
15 | #define PCIVENDOR_3COM 0x10B7 | ||
16 | #define PCIDEVICE_AIRCONNECT 0x7770 | ||
17 | |||
18 | /* Eumitcom PCI WL11000 PCI Adapter (PLX) board device+vendor ID */ | ||
19 | #define PCIVENDOR_EUMITCOM 0x1638UL | ||
20 | #define PCIDEVICE_WL11000 0x1100UL | ||
21 | |||
22 | /* Global Sun Tech GL24110P PCI Adapter (PLX) board device+vendor ID */ | ||
23 | #define PCIVENDOR_GLOBALSUN 0x16abUL | ||
24 | #define PCIDEVICE_GL24110P 0x1101UL | ||
25 | #define PCIDEVICE_GL24110P_ALT 0x1102UL | ||
26 | |||
27 | /* Netgear MA301 PCI Adapter (PLX) board device+vendor ID */ | ||
28 | #define PCIVENDOR_NETGEAR 0x1385UL | ||
29 | #define PCIDEVICE_MA301 0x4100UL | ||
30 | |||
31 | /* US Robotics USR2410 PCI Adapter (PLX) board device+vendor ID */ | ||
32 | #define PCIVENDOR_USROBOTICS 0x16ecUL | ||
33 | #define PCIDEVICE_USR2410 0x3685UL | ||
34 | |||
35 | /* Linksys WPC11 card with the WDT11 adapter (PLX) board device+vendor ID */ | ||
36 | #define PCIVENDOR_Linksys 0x16abUL | ||
37 | #define PCIDEVICE_Wpc11Wdt11 0x1102UL | ||
38 | |||
39 | /* National Datacomm Corp SOHOware Netblaster II PCI */ | ||
40 | #define PCIVENDOR_NDC 0x15e8UL | ||
41 | #define PCIDEVICE_NCP130_PLX 0x0130UL | ||
42 | #define PCIDEVICE_NCP130_ASIC 0x0131UL | ||
43 | |||
44 | /* NDC NCP130_PLX is also sold by Corega. Their name is CGWLPCIA11 */ | ||
45 | #define PCIVENDOR_COREGA PCIVENDOR_NDC | ||
46 | #define PCIDEVICE_CGWLPCIA11 PCIDEVICE_NCP130_PLX | ||
47 | |||
48 | /* PCI Class & Sub-Class code, Network-'Other controller' */ | ||
49 | #define PCI_CLASS_NETWORK_OTHERS 0x280 | ||
50 | |||
51 | /*---------------------------------------------------------------- | ||
52 | * prism2sta_probe_plx | ||
53 | * | ||
54 | * Probe routine called when a PCI device w/ matching ID is found. | ||
55 | * This PLX implementation uses the following map: | ||
56 | * BAR0: Unused | ||
57 | * BAR1: ???? | ||
58 | * BAR2: PCMCIA attribute memory | ||
59 | * BAR3: PCMCIA i/o space | ||
60 | * Here's the sequence: | ||
61 | * - Allocate the PCI resources. | ||
62 | * - Read the PCMCIA attribute memory to make sure we have a WLAN card | ||
63 | * - Reset the MAC using the PCMCIA COR | ||
64 | * - Initialize the netdev and wlan data | ||
65 | * - Initialize the MAC | ||
66 | * | ||
67 | * Arguments: | ||
68 | * pdev ptr to pci device structure containing info about | ||
69 | * pci configuration. | ||
70 | * id ptr to the device id entry that matched this device. | ||
71 | * | ||
72 | * Returns: | ||
73 | * zero - success | ||
74 | * negative - failed | ||
75 | * | ||
76 | * Side effects: | ||
77 | * | ||
78 | * | ||
79 | * Call context: | ||
80 | * process thread | ||
81 | * | ||
82 | ----------------------------------------------------------------*/ | ||
83 | static int __devinit | ||
84 | prism2sta_probe_plx( | ||
85 | struct pci_dev *pdev, | ||
86 | const struct pci_device_id *id) | ||
87 | { | ||
88 | int result; | ||
89 | phys_t pccard_ioaddr; | ||
90 | phys_t pccard_attr_mem; | ||
91 | unsigned int pccard_attr_len; | ||
92 | void __iomem *attr_mem = NULL; | ||
93 | UINT32 plx_addr; | ||
94 | wlandevice_t *wlandev = NULL; | ||
95 | hfa384x_t *hw = NULL; | ||
96 | int reg; | ||
97 | u32 regic; | ||
98 | |||
99 | if (pci_enable_device(pdev)) | ||
100 | return -EIO; | ||
101 | |||
102 | /* TMC7160 boards are special */ | ||
103 | if ((pdev->vendor == PCIVENDOR_NDC) && | ||
104 | (pdev->device == PCIDEVICE_NCP130_ASIC)) { | ||
105 | unsigned long delay; | ||
106 | |||
107 | pccard_attr_mem = 0; | ||
108 | pccard_ioaddr = pci_resource_start(pdev, 1); | ||
109 | |||
110 | outb(0x45, pccard_ioaddr); | ||
111 | delay = jiffies + 1*HZ; | ||
112 | while (time_before(jiffies, delay)); | ||
113 | |||
114 | if (inb(pccard_ioaddr) != 0x45) { | ||
115 | WLAN_LOG_ERROR("Initialize the TMC7160 failed. (0x%x)\n", inb(pccard_ioaddr)); | ||
116 | return -EIO; | ||
117 | } | ||
118 | |||
119 | pccard_ioaddr = pci_resource_start(pdev, 2); | ||
120 | prism2_doreset = 0; | ||
121 | |||
122 | WLAN_LOG_INFO("NDC NCP130 with TMC716(ASIC) PCI interface device found at io:0x%x, irq:%d\n", pccard_ioaddr, pdev->irq); | ||
123 | goto init; | ||
124 | } | ||
125 | |||
126 | /* Collect the resource requirements */ | ||
127 | pccard_attr_mem = pci_resource_start(pdev, 2); | ||
128 | pccard_attr_len = pci_resource_len(pdev, 2); | ||
129 | if (pccard_attr_len < PLX_MIN_ATTR_LEN) | ||
130 | return -EIO; | ||
131 | |||
132 | pccard_ioaddr = pci_resource_start(pdev, 3); | ||
133 | |||
134 | /* bjoern: We need to tell the card to enable interrupts, in | ||
135 | * case the serial eprom didn't do this already. See the | ||
136 | * PLX9052 data book, p8-1 and 8-24 for reference. | ||
137 | * [MSM]: This bit of code came from the orinoco_cs driver. | ||
138 | */ | ||
139 | plx_addr = pci_resource_start(pdev, 1); | ||
140 | |||
141 | regic = 0; | ||
142 | regic = inl(plx_addr+PLX_INTCSR); | ||
143 | if(regic & PLX_INTCSR_INTEN) { | ||
144 | WLAN_LOG_DEBUG(1, | ||
145 | "%s: Local Interrupt already enabled\n", dev_info); | ||
146 | } else { | ||
147 | regic |= PLX_INTCSR_INTEN; | ||
148 | outl(regic, plx_addr+PLX_INTCSR); | ||
149 | regic = inl(plx_addr+PLX_INTCSR); | ||
150 | if(!(regic & PLX_INTCSR_INTEN)) { | ||
151 | WLAN_LOG_ERROR( | ||
152 | "%s: Couldn't enable Local Interrupts\n", | ||
153 | dev_info); | ||
154 | return -EIO; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | /* These assignments are here in case of future mappings for | ||
159 | * io space and irq that might be similar to ioremap | ||
160 | */ | ||
161 | if (!request_mem_region(pccard_attr_mem, pci_resource_len(pdev, 2), "Prism2")) { | ||
162 | WLAN_LOG_ERROR("%s: Couldn't reserve PCI memory region\n", dev_info); | ||
163 | return -EIO; | ||
164 | } | ||
165 | |||
166 | attr_mem = ioremap(pccard_attr_mem, pccard_attr_len); | ||
167 | |||
168 | WLAN_LOG_INFO("A PLX PCI/PCMCIA interface device found, " | ||
169 | "phymem:0x%llx, phyio=0x%x, irq:%d, " | ||
170 | "mem: 0x%lx\n", | ||
171 | (unsigned long long)pccard_attr_mem, pccard_ioaddr, pdev->irq, | ||
172 | (unsigned long)attr_mem); | ||
173 | |||
174 | /* Verify whether PC card is present. | ||
175 | * [MSM] This needs improvement, the right thing to do is | ||
176 | * probably to walk the CIS looking for the vendor and product | ||
177 | * IDs. It would be nice if this could be tied in with the | ||
178 | * etc/pcmcia/wlan-ng.conf file. Any volunteers? ;-) | ||
179 | */ | ||
180 | if ( | ||
181 | readb(attr_mem + 0) != 0x01 || readb(attr_mem + 2) != 0x03 || | ||
182 | readb(attr_mem + 4) != 0x00 || readb(attr_mem + 6) != 0x00 || | ||
183 | readb(attr_mem + 8) != 0xFF || readb(attr_mem + 10) != 0x17 || | ||
184 | readb(attr_mem + 12) != 0x04 || readb(attr_mem + 14) != 0x67) { | ||
185 | WLAN_LOG_ERROR("Prism2 PC card CIS is invalid.\n"); | ||
186 | return -EIO; | ||
187 | } | ||
188 | WLAN_LOG_INFO("A PCMCIA WLAN adapter was found.\n"); | ||
189 | |||
190 | /* Write COR to enable PC card */ | ||
191 | writeb(COR_VALUE, attr_mem + COR_OFFSET); | ||
192 | reg = readb(attr_mem + COR_OFFSET); | ||
193 | |||
194 | init: | ||
195 | |||
196 | /* | ||
197 | * Now do everything the same as a PCI device | ||
198 | * [MSM] TODO: We could probably factor this out of pcmcia/pci/plx | ||
199 | * and perhaps usb. Perhaps a task for another day....... | ||
200 | */ | ||
201 | |||
202 | if ((wlandev = create_wlan()) == NULL) { | ||
203 | WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info); | ||
204 | result = -EIO; | ||
205 | goto failed; | ||
206 | } | ||
207 | |||
208 | hw = wlandev->priv; | ||
209 | |||
210 | if ( wlan_setup(wlandev) != 0 ) { | ||
211 | WLAN_LOG_ERROR("%s: wlan_setup() failed.\n", dev_info); | ||
212 | result = -EIO; | ||
213 | goto failed; | ||
214 | } | ||
215 | |||
216 | /* Setup netdevice's ability to report resources | ||
217 | * Note: the netdevice was allocated by wlan_setup() | ||
218 | */ | ||
219 | wlandev->netdev->irq = pdev->irq; | ||
220 | wlandev->netdev->base_addr = pccard_ioaddr; | ||
221 | wlandev->netdev->mem_start = (unsigned long)attr_mem; | ||
222 | wlandev->netdev->mem_end = (unsigned long)attr_mem + pci_resource_len(pdev, 0); | ||
223 | |||
224 | /* Initialize the hw data */ | ||
225 | hfa384x_create(hw, wlandev->netdev->irq, pccard_ioaddr, attr_mem); | ||
226 | hw->wlandev = wlandev; | ||
227 | |||
228 | /* Register the wlandev, this gets us a name and registers the | ||
229 | * linux netdevice. | ||
230 | */ | ||
231 | SET_MODULE_OWNER(wlandev->netdev); | ||
232 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) | ||
233 | SET_NETDEV_DEV(wlandev->netdev, &(pdev->dev)); | ||
234 | #endif | ||
235 | if ( register_wlandev(wlandev) != 0 ) { | ||
236 | WLAN_LOG_ERROR("%s: register_wlandev() failed.\n", dev_info); | ||
237 | result = -EIO; | ||
238 | goto failed; | ||
239 | } | ||
240 | |||
241 | #if 0 | ||
242 | /* TODO: Move this and an irq test into an hfa384x_testif() routine. | ||
243 | */ | ||
244 | outw(PRISM2STA_MAGIC, HFA384x_SWSUPPORT(wlandev->netdev->base_addr)); | ||
245 | reg=inw( HFA384x_SWSUPPORT(wlandev->netdev->base_addr)); | ||
246 | if ( reg != PRISM2STA_MAGIC ) { | ||
247 | WLAN_LOG_ERROR("MAC register access test failed!\n"); | ||
248 | result = -EIO; | ||
249 | goto failed; | ||
250 | } | ||
251 | #endif | ||
252 | |||
253 | /* Do a chip-level reset on the MAC */ | ||
254 | if (prism2_doreset) { | ||
255 | result = hfa384x_corereset(hw, | ||
256 | prism2_reset_holdtime, | ||
257 | prism2_reset_settletime, 0); | ||
258 | if (result != 0) { | ||
259 | unregister_wlandev(wlandev); | ||
260 | hfa384x_destroy(hw); | ||
261 | WLAN_LOG_ERROR( | ||
262 | "%s: hfa384x_corereset() failed.\n", | ||
263 | dev_info); | ||
264 | result = -EIO; | ||
265 | goto failed; | ||
266 | } | ||
267 | } | ||
268 | |||
269 | pci_set_drvdata(pdev, wlandev); | ||
270 | |||
271 | /* Shouldn't actually hook up the IRQ until we | ||
272 | * _know_ things are alright. A test routine would help. | ||
273 | */ | ||
274 | request_irq(wlandev->netdev->irq, hfa384x_interrupt, | ||
275 | SA_SHIRQ, wlandev->name, wlandev); | ||
276 | |||
277 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
278 | |||
279 | result = 0; | ||
280 | |||
281 | goto done; | ||
282 | |||
283 | failed: | ||
284 | |||
285 | pci_set_drvdata(pdev, NULL); | ||
286 | if (wlandev) kfree(wlandev); | ||
287 | if (hw) kfree(hw); | ||
288 | if (attr_mem) iounmap(attr_mem); | ||
289 | pci_release_regions(pdev); | ||
290 | pci_disable_device(pdev); | ||
291 | |||
292 | done: | ||
293 | DBFEXIT; | ||
294 | return result; | ||
295 | } | ||
296 | |||
297 | static void __devexit prism2sta_remove_plx(struct pci_dev *pdev) | ||
298 | { | ||
299 | wlandevice_t *wlandev; | ||
300 | hfa384x_t *hw; | ||
301 | |||
302 | wlandev = (wlandevice_t *) pci_get_drvdata(pdev); | ||
303 | hw = wlandev->priv; | ||
304 | |||
305 | p80211netdev_hwremoved(wlandev); | ||
306 | |||
307 | /* reset hardware */ | ||
308 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
309 | |||
310 | if (pdev->irq) | ||
311 | free_irq(pdev->irq, wlandev); | ||
312 | |||
313 | unregister_wlandev(wlandev); | ||
314 | |||
315 | /* free local stuff */ | ||
316 | if (hw) { | ||
317 | hfa384x_destroy(hw); | ||
318 | kfree(hw); | ||
319 | } | ||
320 | |||
321 | iounmap((void __iomem *)wlandev->netdev->mem_start); | ||
322 | wlan_unsetup(wlandev); | ||
323 | |||
324 | pci_release_regions(pdev); | ||
325 | pci_disable_device(pdev); | ||
326 | pci_set_drvdata(pdev, NULL); | ||
327 | |||
328 | kfree(wlandev); | ||
329 | } | ||
330 | |||
331 | static struct pci_device_id plx_id_tbl[] = { | ||
332 | { | ||
333 | PCIVENDOR_EUMITCOM, PCIDEVICE_WL11000, | ||
334 | PCI_ANY_ID, PCI_ANY_ID, | ||
335 | 0, 0, | ||
336 | /* Driver data, we just put the name here */ | ||
337 | (unsigned long)"Eumitcom WL11000 PCI(PLX) card" | ||
338 | }, | ||
339 | { | ||
340 | PCIVENDOR_GLOBALSUN, PCIDEVICE_GL24110P, | ||
341 | PCI_ANY_ID, PCI_ANY_ID, | ||
342 | 0, 0, | ||
343 | /* Driver data, we just put the name here */ | ||
344 | (unsigned long)"Global Sun Tech GL24110P PCI(PLX) card" | ||
345 | }, | ||
346 | { | ||
347 | PCIVENDOR_GLOBALSUN, PCIDEVICE_GL24110P_ALT, | ||
348 | PCI_ANY_ID, PCI_ANY_ID, | ||
349 | 0, 0, | ||
350 | /* Driver data, we just put the name here */ | ||
351 | (unsigned long)"Global Sun Tech GL24110P PCI(PLX) card" | ||
352 | }, | ||
353 | { | ||
354 | PCIVENDOR_NETGEAR, PCIDEVICE_MA301, | ||
355 | PCI_ANY_ID, PCI_ANY_ID, | ||
356 | 0, 0, | ||
357 | /* Driver data, we just put the name here */ | ||
358 | (unsigned long)"Global Sun Tech GL24110P PCI(PLX) card" | ||
359 | }, | ||
360 | { | ||
361 | PCIVENDOR_USROBOTICS, PCIDEVICE_USR2410, | ||
362 | PCI_ANY_ID, PCI_ANY_ID, | ||
363 | 0, 0, | ||
364 | /* Driver data, we just put the name here */ | ||
365 | (unsigned long)"US Robotics USR2410 PCI(PLX) card" | ||
366 | }, | ||
367 | { | ||
368 | PCIVENDOR_Linksys, PCIDEVICE_Wpc11Wdt11, | ||
369 | PCI_ANY_ID, PCI_ANY_ID, | ||
370 | 0, 0, | ||
371 | /* Driver data, we just put the name here */ | ||
372 | (unsigned long)"Linksys WPC11 with WDT11 PCI(PLX) adapter" | ||
373 | }, | ||
374 | { | ||
375 | PCIVENDOR_NDC, PCIDEVICE_NCP130_PLX, | ||
376 | PCI_ANY_ID, PCI_ANY_ID, | ||
377 | 0, 0, | ||
378 | /* Driver data, we just put the name here */ | ||
379 | (unsigned long)"NDC Netblaster II PCI(PLX)" | ||
380 | }, | ||
381 | { | ||
382 | PCIVENDOR_NDC, PCIDEVICE_NCP130_ASIC, | ||
383 | PCI_ANY_ID, PCI_ANY_ID, | ||
384 | 0, 0, | ||
385 | /* Driver data, we just put the name here */ | ||
386 | (unsigned long)"NDC Netblaster II PCI(TMC7160)" | ||
387 | }, | ||
388 | { | ||
389 | PCIVENDOR_3COM, PCIDEVICE_AIRCONNECT, | ||
390 | PCI_ANY_ID, PCI_ANY_ID, | ||
391 | 0, 0, | ||
392 | /* Driver data, we just put the name here */ | ||
393 | (unsigned long)"3Com AirConnect PCI 802.11b 11Mb/s WLAN Controller" | ||
394 | }, | ||
395 | { | ||
396 | 0, 0, 0, 0, 0, 0, 0 | ||
397 | } | ||
398 | }; | ||
399 | |||
400 | MODULE_DEVICE_TABLE(pci, plx_id_tbl); | ||
401 | |||
402 | /* Function declared here because of ptr reference below */ | ||
403 | static int __devinit prism2sta_probe_plx(struct pci_dev *pdev, | ||
404 | const struct pci_device_id *); | ||
405 | static void __devexit prism2sta_remove_plx(struct pci_dev *pdev); | ||
406 | |||
407 | static struct pci_driver prism2_plx_drv_id = { | ||
408 | .name = "prism2_plx", | ||
409 | .id_table = plx_id_tbl, | ||
410 | .probe = prism2sta_probe_plx, | ||
411 | .remove = prism2sta_remove_plx, | ||
412 | #ifdef CONFIG_PM | ||
413 | .suspend = prism2sta_suspend_pci, | ||
414 | .resume = prism2sta_resume_pci, | ||
415 | #endif | ||
416 | }; | ||
417 | |||
418 | #ifdef MODULE | ||
419 | |||
420 | static int __init prism2plx_init(void) | ||
421 | { | ||
422 | WLAN_LOG_NOTICE("%s Loaded\n", version); | ||
423 | return pci_module_init(&prism2_plx_drv_id); | ||
424 | }; | ||
425 | |||
426 | static void __exit prism2plx_cleanup(void) | ||
427 | { | ||
428 | pci_unregister_driver(&prism2_plx_drv_id); | ||
429 | }; | ||
430 | |||
431 | module_init(prism2plx_init); | ||
432 | module_exit(prism2plx_cleanup); | ||
433 | |||
434 | #endif // MODULE | ||
435 | |||
436 | |||
437 | int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis) | ||
438 | { | ||
439 | int result = 0; | ||
440 | |||
441 | #define COR_OFFSET 0x3e0 /* COR attribute offset of Prism2 PC card */ | ||
442 | #define COR_VALUE 0x41 /* Enable PC card with irq in level trigger */ | ||
443 | |||
444 | #define HCR_OFFSET 0x3e2 /* HCR attribute offset of Prism2 PC card */ | ||
445 | |||
446 | UINT8 corsave; | ||
447 | DBFENTER; | ||
448 | |||
449 | WLAN_LOG_DEBUG(3, "Doing reset via direct COR access.\n"); | ||
450 | |||
451 | /* Collect COR */ | ||
452 | corsave = readb(hw->membase + COR_OFFSET); | ||
453 | /* Write reset bit (BIT7) */ | ||
454 | writeb(corsave | BIT7, hw->membase + COR_OFFSET); | ||
455 | /* Hold for holdtime */ | ||
456 | mdelay(holdtime); | ||
457 | |||
458 | if (genesis) { | ||
459 | writeb(genesis, hw->membase + HCR_OFFSET); | ||
460 | /* Hold for holdtime */ | ||
461 | mdelay(holdtime); | ||
462 | } | ||
463 | |||
464 | /* Clear reset bit */ | ||
465 | writeb(corsave & ~BIT7, hw->membase + COR_OFFSET); | ||
466 | /* Wait for settletime */ | ||
467 | mdelay(settletime); | ||
468 | /* Set non-reset bits back what they were */ | ||
469 | writeb(corsave, hw->membase + COR_OFFSET); | ||
470 | DBFEXIT; | ||
471 | return result; | ||
472 | } | ||
diff --git a/drivers/staging/wlan-ng/prism2_usb.c b/drivers/staging/wlan-ng/prism2_usb.c new file mode 100644 index 000000000000..e45be2374503 --- /dev/null +++ b/drivers/staging/wlan-ng/prism2_usb.c | |||
@@ -0,0 +1,361 @@ | |||
1 | #define WLAN_HOSTIF WLAN_USB | ||
2 | #include "hfa384x_usb.c" | ||
3 | #include "prism2mgmt.c" | ||
4 | #include "prism2mib.c" | ||
5 | #include "prism2sta.c" | ||
6 | |||
7 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) | ||
8 | #error "prism2_usb requires at least a 2.4.x kernel!" | ||
9 | #endif | ||
10 | |||
11 | #define PRISM_USB_DEVICE(vid, pid, name) \ | ||
12 | USB_DEVICE(vid, pid), \ | ||
13 | .driver_info = (unsigned long) name | ||
14 | |||
15 | static struct usb_device_id usb_prism_tbl[] = { | ||
16 | {PRISM_USB_DEVICE(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS")}, | ||
17 | {PRISM_USB_DEVICE(0x07aa, 0x0012, "Corega Wireless LAN USB Stick-11")}, | ||
18 | {PRISM_USB_DEVICE(0x09aa, 0x3642, "Prism2.x 11Mbps WLAN USB Adapter")}, | ||
19 | {PRISM_USB_DEVICE(0x1668, 0x0408, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")}, | ||
20 | {PRISM_USB_DEVICE(0x1668, 0x0421, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")}, | ||
21 | {PRISM_USB_DEVICE(0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps WLAN USB Adapter")}, | ||
22 | {PRISM_USB_DEVICE(0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps WLAN USB Adapter")}, | ||
23 | {PRISM_USB_DEVICE(0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter")}, | ||
24 | {PRISM_USB_DEVICE(0x067c, 0x1022, "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter")}, | ||
25 | {PRISM_USB_DEVICE(0x049f, 0x0033, "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter")}, | ||
26 | {PRISM_USB_DEVICE(0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter")}, | ||
27 | {PRISM_USB_DEVICE(0x08de, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")}, | ||
28 | {PRISM_USB_DEVICE(0x8086, 0x1111, "Intel PRO/Wireless 2011B LAN USB Adapter")}, | ||
29 | {PRISM_USB_DEVICE(0x0d8e, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")}, | ||
30 | {PRISM_USB_DEVICE(0x045e, 0x006e, "Microsoft MN510 Wireless USB Adapter")}, | ||
31 | {PRISM_USB_DEVICE(0x0967, 0x0204, "Acer Warplink USB Adapter")}, | ||
32 | {PRISM_USB_DEVICE(0x0cde, 0x0002, "Z-Com 725/726 Prism2.5 USB/USB Integrated")}, | ||
33 | {PRISM_USB_DEVICE(0x0cde, 0x0005, "Z-Com Xl735 Wireless 802.11b USB Adapter")}, | ||
34 | {PRISM_USB_DEVICE(0x413c, 0x8100, "Dell TrueMobile 1180 Wireless USB Adapter")}, | ||
35 | {PRISM_USB_DEVICE(0x0b3b, 0x1601, "ALLNET 0193 11Mbps WLAN USB Adapter")}, | ||
36 | {PRISM_USB_DEVICE(0x0b3b, 0x1602, "ZyXEL ZyAIR B200 Wireless USB Adapter")}, | ||
37 | {PRISM_USB_DEVICE(0x0baf, 0x00eb, "USRobotics USR1120 Wireless USB Adapter")}, | ||
38 | {PRISM_USB_DEVICE(0x0411, 0x0027, "Melco WLI-USB-KS11G 11Mbps WLAN Adapter")}, | ||
39 | {PRISM_USB_DEVICE(0x04f1, 0x3009, "JVC MP-XP7250 Builtin USB WLAN Adapter")}, | ||
40 | {PRISM_USB_DEVICE(0x0846, 0x4110, "NetGear MA111")}, | ||
41 | {PRISM_USB_DEVICE(0x03f3, 0x0020, "Adaptec AWN-8020 USB WLAN Adapter")}, | ||
42 | // {PRISM_USB_DEVICE(0x0ace, 0x1201, "ZyDAS ZD1201 Wireless USB Adapter")}, | ||
43 | {PRISM_USB_DEVICE(0x2821, 0x3300, "ASUS-WL140 Wireless USB Adapter")}, | ||
44 | {PRISM_USB_DEVICE(0x2001, 0x3700, "DWL-122 Wireless USB Adapter")}, | ||
45 | {PRISM_USB_DEVICE(0x2001, 0x3702, "DWL-120 Rev F Wireless USB Adapter")}, | ||
46 | {PRISM_USB_DEVICE(0x50c2, 0x4013, "Averatec USB WLAN Adapter")}, | ||
47 | {PRISM_USB_DEVICE(0x2c02, 0x14ea, "Planex GW-US11H WLAN USB Adapter")}, | ||
48 | {PRISM_USB_DEVICE(0x124a, 0x168b, "Airvast PRISM3 WLAN USB Adapter")}, | ||
49 | {PRISM_USB_DEVICE(0x083a, 0x3503, "T-Sinus 111 USB WLAN Adapter")}, | ||
50 | {PRISM_USB_DEVICE(0x2821, 0x3300, "Hawking HighDB USB Adapter")}, | ||
51 | {PRISM_USB_DEVICE(0x0411, 0x0044, "Melco WLI-USB-KB11 11Mbps WLAN Adapter")}, | ||
52 | {PRISM_USB_DEVICE(0x1668, 0x6106, "ROPEX FreeLan 802.11b USB Adapter")}, | ||
53 | {PRISM_USB_DEVICE(0x124a, 0x4017, "Pheenet WL-503IA 802.11b USB Adapter")}, | ||
54 | {PRISM_USB_DEVICE(0x0bb2, 0x0302, "Ambit Microsystems Corp.")}, | ||
55 | {PRISM_USB_DEVICE(0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter")}, | ||
56 | {PRISM_USB_DEVICE(0x0543, 0x0f01, "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)")}, | ||
57 | { /* terminator */ } | ||
58 | }; | ||
59 | |||
60 | MODULE_DEVICE_TABLE(usb, usb_prism_tbl); | ||
61 | |||
62 | /*---------------------------------------------------------------- | ||
63 | * prism2sta_probe_usb | ||
64 | * | ||
65 | * Probe routine called by the USB subsystem. | ||
66 | * | ||
67 | * Arguments: | ||
68 | * dev ptr to the usb_device struct | ||
69 | * ifnum interface number being offered | ||
70 | * | ||
71 | * Returns: | ||
72 | * NULL - we're not claiming the device+interface | ||
73 | * non-NULL - we are claiming the device+interface and | ||
74 | * this is a ptr to the data we want back | ||
75 | * when disconnect is called. | ||
76 | * | ||
77 | * Side effects: | ||
78 | * | ||
79 | * Call context: | ||
80 | * I'm not sure, assume it's interrupt. | ||
81 | * | ||
82 | ----------------------------------------------------------------*/ | ||
83 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
84 | static void __devinit *prism2sta_probe_usb( | ||
85 | struct usb_device *dev, | ||
86 | unsigned int ifnum, | ||
87 | const struct usb_device_id *id) | ||
88 | #else | ||
89 | static int prism2sta_probe_usb( | ||
90 | struct usb_interface *interface, | ||
91 | const struct usb_device_id *id) | ||
92 | #endif | ||
93 | { | ||
94 | |||
95 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
96 | struct usb_interface *interface; | ||
97 | #else | ||
98 | struct usb_device *dev; | ||
99 | #endif | ||
100 | |||
101 | wlandevice_t *wlandev = NULL; | ||
102 | hfa384x_t *hw = NULL; | ||
103 | int result = 0; | ||
104 | |||
105 | DBFENTER; | ||
106 | |||
107 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
108 | interface = &dev->actconfig->interface[ifnum]; | ||
109 | #else | ||
110 | dev = interface_to_usbdev(interface); | ||
111 | #endif | ||
112 | |||
113 | |||
114 | if ((wlandev = create_wlan()) == NULL) { | ||
115 | WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info); | ||
116 | result = -EIO; | ||
117 | goto failed; | ||
118 | } | ||
119 | hw = wlandev->priv; | ||
120 | |||
121 | if ( wlan_setup(wlandev) != 0 ) { | ||
122 | WLAN_LOG_ERROR("%s: wlan_setup() failed.\n", dev_info); | ||
123 | result = -EIO; | ||
124 | goto failed; | ||
125 | } | ||
126 | |||
127 | /* Initialize the hw data */ | ||
128 | hfa384x_create(hw, dev); | ||
129 | hw->wlandev = wlandev; | ||
130 | |||
131 | /* Register the wlandev, this gets us a name and registers the | ||
132 | * linux netdevice. | ||
133 | */ | ||
134 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) | ||
135 | SET_NETDEV_DEV(wlandev->netdev, &(interface->dev)); | ||
136 | #endif | ||
137 | if ( register_wlandev(wlandev) != 0 ) { | ||
138 | WLAN_LOG_ERROR("%s: register_wlandev() failed.\n", dev_info); | ||
139 | result = -EIO; | ||
140 | goto failed; | ||
141 | } | ||
142 | |||
143 | /* Do a chip-level reset on the MAC */ | ||
144 | if (prism2_doreset) { | ||
145 | result = hfa384x_corereset(hw, | ||
146 | prism2_reset_holdtime, | ||
147 | prism2_reset_settletime, 0); | ||
148 | if (result != 0) { | ||
149 | unregister_wlandev(wlandev); | ||
150 | hfa384x_destroy(hw); | ||
151 | result = -EIO; | ||
152 | WLAN_LOG_ERROR( | ||
153 | "%s: hfa384x_corereset() failed.\n", | ||
154 | dev_info); | ||
155 | goto failed; | ||
156 | } | ||
157 | } | ||
158 | |||
159 | #ifndef NEW_MODULE_CODE | ||
160 | usb_inc_dev_use(dev); | ||
161 | #endif | ||
162 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)) | ||
163 | usb_get_dev(dev); | ||
164 | #endif | ||
165 | |||
166 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
167 | |||
168 | goto done; | ||
169 | |||
170 | failed: | ||
171 | if (wlandev) kfree(wlandev); | ||
172 | if (hw) kfree(hw); | ||
173 | wlandev = NULL; | ||
174 | |||
175 | done: | ||
176 | DBFEXIT; | ||
177 | |||
178 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
179 | return wlandev; | ||
180 | #else | ||
181 | usb_set_intfdata(interface, wlandev); | ||
182 | return result; | ||
183 | #endif | ||
184 | } | ||
185 | |||
186 | |||
187 | /*---------------------------------------------------------------- | ||
188 | * prism2sta_disconnect_usb | ||
189 | * | ||
190 | * Called when a device previously claimed by probe is removed | ||
191 | * from the USB. | ||
192 | * | ||
193 | * Arguments: | ||
194 | * dev ptr to the usb_device struct | ||
195 | * ptr ptr returned by probe() when the device | ||
196 | * was claimed. | ||
197 | * | ||
198 | * Returns: | ||
199 | * Nothing | ||
200 | * | ||
201 | * Side effects: | ||
202 | * | ||
203 | * Call context: | ||
204 | * process | ||
205 | ----------------------------------------------------------------*/ | ||
206 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
207 | static void __devexit | ||
208 | prism2sta_disconnect_usb(struct usb_device *dev, void *ptr) | ||
209 | #else | ||
210 | static void | ||
211 | prism2sta_disconnect_usb(struct usb_interface *interface) | ||
212 | #endif | ||
213 | { | ||
214 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) | ||
215 | wlandevice_t *wlandev; | ||
216 | #else | ||
217 | wlandevice_t *wlandev = (wlandevice_t*)ptr; | ||
218 | #endif | ||
219 | |||
220 | DBFENTER; | ||
221 | |||
222 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) | ||
223 | wlandev = (wlandevice_t *) usb_get_intfdata(interface); | ||
224 | #endif | ||
225 | |||
226 | if ( wlandev != NULL ) { | ||
227 | LIST_HEAD(cleanlist); | ||
228 | struct list_head *entry; | ||
229 | struct list_head *temp; | ||
230 | unsigned long flags; | ||
231 | |||
232 | hfa384x_t *hw = wlandev->priv; | ||
233 | |||
234 | if (!hw) | ||
235 | goto exit; | ||
236 | |||
237 | spin_lock_irqsave(&hw->ctlxq.lock, flags); | ||
238 | |||
239 | p80211netdev_hwremoved(wlandev); | ||
240 | list_splice_init(&hw->ctlxq.reapable, &cleanlist); | ||
241 | list_splice_init(&hw->ctlxq.completing, &cleanlist); | ||
242 | list_splice_init(&hw->ctlxq.pending, &cleanlist); | ||
243 | list_splice_init(&hw->ctlxq.active, &cleanlist); | ||
244 | |||
245 | spin_unlock_irqrestore(&hw->ctlxq.lock, flags); | ||
246 | |||
247 | /* There's no hardware to shutdown, but the driver | ||
248 | * might have some tasks or tasklets that must be | ||
249 | * stopped before we can tear everything down. | ||
250 | */ | ||
251 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
252 | |||
253 | del_singleshot_timer_sync(&hw->throttle); | ||
254 | del_singleshot_timer_sync(&hw->reqtimer); | ||
255 | del_singleshot_timer_sync(&hw->resptimer); | ||
256 | |||
257 | /* Unlink all the URBs. This "removes the wheels" | ||
258 | * from the entire CTLX handling mechanism. | ||
259 | */ | ||
260 | usb_kill_urb(&hw->rx_urb); | ||
261 | usb_kill_urb(&hw->tx_urb); | ||
262 | usb_kill_urb(&hw->ctlx_urb); | ||
263 | |||
264 | tasklet_kill(&hw->completion_bh); | ||
265 | tasklet_kill(&hw->reaper_bh); | ||
266 | |||
267 | flush_scheduled_work(); | ||
268 | |||
269 | /* Now we complete any outstanding commands | ||
270 | * and tell everyone who is waiting for their | ||
271 | * responses that we have shut down. | ||
272 | */ | ||
273 | list_for_each(entry, &cleanlist) { | ||
274 | hfa384x_usbctlx_t *ctlx; | ||
275 | |||
276 | ctlx = list_entry(entry, hfa384x_usbctlx_t, list); | ||
277 | complete(&ctlx->done); | ||
278 | } | ||
279 | |||
280 | /* Give any outstanding synchronous commands | ||
281 | * a chance to complete. All they need to do | ||
282 | * is "wake up", so that's easy. | ||
283 | * (I'd like a better way to do this, really.) | ||
284 | */ | ||
285 | msleep(100); | ||
286 | |||
287 | /* Now delete the CTLXs, because no-one else can now. */ | ||
288 | list_for_each_safe(entry, temp, &cleanlist) { | ||
289 | hfa384x_usbctlx_t *ctlx; | ||
290 | |||
291 | ctlx = list_entry(entry, hfa384x_usbctlx_t, list); | ||
292 | kfree(ctlx); | ||
293 | } | ||
294 | |||
295 | /* Unhook the wlandev */ | ||
296 | unregister_wlandev(wlandev); | ||
297 | wlan_unsetup(wlandev); | ||
298 | |||
299 | #ifndef NEW_MODULE_CODE | ||
300 | usb_dec_dev_use(hw->usb); | ||
301 | #endif | ||
302 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)) | ||
303 | usb_put_dev(hw->usb); | ||
304 | #endif | ||
305 | |||
306 | hfa384x_destroy(hw); | ||
307 | kfree(hw); | ||
308 | |||
309 | kfree(wlandev); | ||
310 | } | ||
311 | |||
312 | exit: | ||
313 | |||
314 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) | ||
315 | usb_set_intfdata(interface, NULL); | ||
316 | #endif | ||
317 | DBFEXIT; | ||
318 | } | ||
319 | |||
320 | |||
321 | static struct usb_driver prism2_usb_driver = { | ||
322 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)) | ||
323 | .owner = THIS_MODULE, | ||
324 | #endif | ||
325 | .name = "prism2_usb", | ||
326 | .probe = prism2sta_probe_usb, | ||
327 | .disconnect = prism2sta_disconnect_usb, | ||
328 | .id_table = usb_prism_tbl, | ||
329 | /* fops, minor? */ | ||
330 | }; | ||
331 | |||
332 | #ifdef MODULE | ||
333 | |||
334 | static int __init prism2usb_init(void) | ||
335 | { | ||
336 | DBFENTER; | ||
337 | |||
338 | WLAN_LOG_NOTICE("%s Loaded\n", version); | ||
339 | WLAN_LOG_NOTICE("dev_info is: %s\n", dev_info); | ||
340 | |||
341 | /* This call will result in calls to prism2sta_probe_usb. */ | ||
342 | return usb_register(&prism2_usb_driver); | ||
343 | |||
344 | DBFEXIT; | ||
345 | }; | ||
346 | |||
347 | static void __exit prism2usb_cleanup(void) | ||
348 | { | ||
349 | DBFENTER; | ||
350 | |||
351 | usb_deregister(&prism2_usb_driver); | ||
352 | |||
353 | printk(KERN_NOTICE "%s Unloaded\n", version); | ||
354 | |||
355 | DBFEXIT; | ||
356 | }; | ||
357 | |||
358 | module_init(prism2usb_init); | ||
359 | module_exit(prism2usb_cleanup); | ||
360 | |||
361 | #endif // module | ||
diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c new file mode 100644 index 000000000000..c975025b6ae0 --- /dev/null +++ b/drivers/staging/wlan-ng/prism2mgmt.c | |||
@@ -0,0 +1,2956 @@ | |||
1 | /* src/prism2/driver/prism2mgmt.c | ||
2 | * | ||
3 | * Management request handler functions. | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * The functions in this file handle management requests sent from | ||
48 | * user mode. | ||
49 | * | ||
50 | * Most of these functions have two separate blocks of code that are | ||
51 | * conditional on whether this is a station or an AP. This is used | ||
52 | * to separate out the STA and AP responses to these management primitives. | ||
53 | * It's a choice (good, bad, indifferent?) to have the code in the same | ||
54 | * place so it's clear that the same primitive is implemented in both | ||
55 | * cases but has different behavior. | ||
56 | * | ||
57 | * -------------------------------------------------------------------- | ||
58 | */ | ||
59 | |||
60 | /*================================================================*/ | ||
61 | /* System Includes */ | ||
62 | #define WLAN_DBVAR prism2_debug | ||
63 | |||
64 | #include "version.h" | ||
65 | |||
66 | |||
67 | #include <linux/version.h> | ||
68 | |||
69 | #include <linux/if_arp.h> | ||
70 | #include <linux/module.h> | ||
71 | #include <linux/kernel.h> | ||
72 | #include <linux/wait.h> | ||
73 | #include <linux/sched.h> | ||
74 | #include <linux/types.h> | ||
75 | #include <linux/slab.h> | ||
76 | #include <linux/wireless.h> | ||
77 | #include <linux/netdevice.h> | ||
78 | #include <linux/delay.h> | ||
79 | #include <asm/io.h> | ||
80 | #include <asm/byteorder.h> | ||
81 | #include <linux/random.h> | ||
82 | |||
83 | #if (WLAN_HOSTIF == WLAN_USB) | ||
84 | #include <linux/usb.h> | ||
85 | #endif | ||
86 | |||
87 | #if (WLAN_HOSTIF == WLAN_PCMCIA) | ||
88 | #include <pcmcia/version.h> | ||
89 | #include <pcmcia/cs_types.h> | ||
90 | #include <pcmcia/cs.h> | ||
91 | #include <pcmcia/cistpl.h> | ||
92 | #include <pcmcia/ds.h> | ||
93 | #include <pcmcia/cisreg.h> | ||
94 | #endif | ||
95 | |||
96 | #include "wlan_compat.h" | ||
97 | |||
98 | /*================================================================*/ | ||
99 | /* Project Includes */ | ||
100 | |||
101 | #include "p80211types.h" | ||
102 | #include "p80211hdr.h" | ||
103 | #include "p80211mgmt.h" | ||
104 | #include "p80211conv.h" | ||
105 | #include "p80211msg.h" | ||
106 | #include "p80211netdev.h" | ||
107 | #include "p80211metadef.h" | ||
108 | #include "p80211metastruct.h" | ||
109 | #include "hfa384x.h" | ||
110 | #include "prism2mgmt.h" | ||
111 | |||
112 | /*================================================================*/ | ||
113 | /* Local Constants */ | ||
114 | |||
115 | |||
116 | /*================================================================*/ | ||
117 | /* Local Macros */ | ||
118 | |||
119 | /* Converts 802.11 format rate specifications to prism2 */ | ||
120 | #define p80211rate_to_p2bit(n) ((((n)&~BIT7) == 2) ? BIT0 : \ | ||
121 | (((n)&~BIT7) == 4) ? BIT1 : \ | ||
122 | (((n)&~BIT7) == 11) ? BIT2 : \ | ||
123 | (((n)&~BIT7) == 22) ? BIT3 : 0) | ||
124 | |||
125 | /*================================================================*/ | ||
126 | /* Local Types */ | ||
127 | |||
128 | |||
129 | /*================================================================*/ | ||
130 | /* Local Static Definitions */ | ||
131 | |||
132 | |||
133 | /*================================================================*/ | ||
134 | /* Local Function Declarations */ | ||
135 | |||
136 | |||
137 | /*================================================================*/ | ||
138 | /* Function Definitions */ | ||
139 | |||
140 | |||
141 | /*---------------------------------------------------------------- | ||
142 | * prism2mgmt_powermgmt | ||
143 | * | ||
144 | * Set the power management state of this station's MAC. | ||
145 | * | ||
146 | * Arguments: | ||
147 | * wlandev wlan device structure | ||
148 | * msgp ptr to msg buffer | ||
149 | * | ||
150 | * Returns: | ||
151 | * 0 success and done | ||
152 | * <0 success, but we're waiting for something to finish. | ||
153 | * >0 an error occurred while handling the message. | ||
154 | * Side effects: | ||
155 | * | ||
156 | * Call context: | ||
157 | * process thread (usually) | ||
158 | * interrupt | ||
159 | ----------------------------------------------------------------*/ | ||
160 | int prism2mgmt_powermgmt(wlandevice_t *wlandev, void *msgp) | ||
161 | { | ||
162 | int result = 0; | ||
163 | hfa384x_t *hw = wlandev->priv; | ||
164 | p80211msg_dot11req_powermgmt_t *msg = msgp; | ||
165 | |||
166 | DBFENTER; | ||
167 | |||
168 | if (!hw->ap) { | ||
169 | |||
170 | /*** STATION ***/ | ||
171 | |||
172 | /* | ||
173 | * Set CNFPMENABLED (on or off) | ||
174 | * Set CNFMULTICASTRX (if PM on, otherwise clear) | ||
175 | * Spout a notice stating that SleepDuration and | ||
176 | * HoldoverDuration and PMEPS also have an impact. | ||
177 | */ | ||
178 | /* Powermgmt is currently unsupported for STA */ | ||
179 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
180 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
181 | } else { | ||
182 | |||
183 | /*** ACCESS POINT ***/ | ||
184 | |||
185 | /* Powermgmt is never supported for AP */ | ||
186 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
187 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
188 | } | ||
189 | |||
190 | DBFEXIT; | ||
191 | return result; | ||
192 | } | ||
193 | |||
194 | |||
195 | /*---------------------------------------------------------------- | ||
196 | * prism2mgmt_scan | ||
197 | * | ||
198 | * Initiate a scan for BSSs. | ||
199 | * | ||
200 | * This function corresponds to MLME-scan.request and part of | ||
201 | * MLME-scan.confirm. As far as I can tell in the standard, there | ||
202 | * are no restrictions on when a scan.request may be issued. We have | ||
203 | * to handle in whatever state the driver/MAC happen to be. | ||
204 | * | ||
205 | * Arguments: | ||
206 | * wlandev wlan device structure | ||
207 | * msgp ptr to msg buffer | ||
208 | * | ||
209 | * Returns: | ||
210 | * 0 success and done | ||
211 | * <0 success, but we're waiting for something to finish. | ||
212 | * >0 an error occurred while handling the message. | ||
213 | * Side effects: | ||
214 | * | ||
215 | * Call context: | ||
216 | * process thread (usually) | ||
217 | * interrupt | ||
218 | ----------------------------------------------------------------*/ | ||
219 | int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) | ||
220 | { | ||
221 | int result = 0; | ||
222 | hfa384x_t *hw = wlandev->priv; | ||
223 | p80211msg_dot11req_scan_t *msg = msgp; | ||
224 | UINT16 roamingmode, word; | ||
225 | int i, timeout; | ||
226 | int istmpenable = 0; | ||
227 | |||
228 | hfa384x_HostScanRequest_data_t scanreq; | ||
229 | |||
230 | DBFENTER; | ||
231 | |||
232 | if (hw->ap) { | ||
233 | WLAN_LOG_ERROR("Prism2 in AP mode cannot perform scans.\n"); | ||
234 | result = 1; | ||
235 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
236 | goto exit; | ||
237 | } | ||
238 | |||
239 | /* gatekeeper check */ | ||
240 | if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, | ||
241 | hw->ident_sta_fw.minor, | ||
242 | hw->ident_sta_fw.variant) < | ||
243 | HFA384x_FIRMWARE_VERSION(1,3,2)) { | ||
244 | WLAN_LOG_ERROR("HostScan not supported with current firmware (<1.3.2).\n"); | ||
245 | result = 1; | ||
246 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
247 | goto exit; | ||
248 | } | ||
249 | |||
250 | memset(&scanreq, 0, sizeof(scanreq)); | ||
251 | |||
252 | /* save current roaming mode */ | ||
253 | result = hfa384x_drvr_getconfig16(hw, | ||
254 | HFA384x_RID_CNFROAMINGMODE, &roamingmode); | ||
255 | if ( result ) { | ||
256 | WLAN_LOG_ERROR("getconfig(ROAMMODE) failed. result=%d\n", | ||
257 | result); | ||
258 | msg->resultcode.data = | ||
259 | P80211ENUM_resultcode_implementation_failure; | ||
260 | goto exit; | ||
261 | } | ||
262 | |||
263 | /* drop into mode 3 for the scan */ | ||
264 | result = hfa384x_drvr_setconfig16(hw, | ||
265 | HFA384x_RID_CNFROAMINGMODE, | ||
266 | HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM); | ||
267 | if ( result ) { | ||
268 | WLAN_LOG_ERROR("setconfig(ROAMINGMODE) failed. result=%d\n", | ||
269 | result); | ||
270 | msg->resultcode.data = | ||
271 | P80211ENUM_resultcode_implementation_failure; | ||
272 | goto exit; | ||
273 | } | ||
274 | |||
275 | /* active or passive? */ | ||
276 | if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, | ||
277 | hw->ident_sta_fw.minor, | ||
278 | hw->ident_sta_fw.variant) > | ||
279 | HFA384x_FIRMWARE_VERSION(1,5,0)) { | ||
280 | if (msg->scantype.data != P80211ENUM_scantype_active) { | ||
281 | word = host2hfa384x_16(msg->maxchanneltime.data); | ||
282 | } else { | ||
283 | word = 0; | ||
284 | } | ||
285 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPASSIVESCANCTRL, word); | ||
286 | if ( result ) { | ||
287 | WLAN_LOG_WARNING("Passive scan not supported with " | ||
288 | "current firmware. (<1.5.1)\n"); | ||
289 | } | ||
290 | } | ||
291 | |||
292 | /* set up the txrate to be 2MBPS. Should be fastest basicrate... */ | ||
293 | word = HFA384x_RATEBIT_2; | ||
294 | scanreq.txRate = host2hfa384x_16(word); | ||
295 | |||
296 | /* set up the channel list */ | ||
297 | word = 0; | ||
298 | for (i = 0; i < msg->channellist.data.len; i++) { | ||
299 | UINT8 channel = msg->channellist.data.data[i]; | ||
300 | if (channel > 14) continue; | ||
301 | /* channel 1 is BIT0 ... channel 14 is BIT13 */ | ||
302 | word |= (1 << (channel-1)); | ||
303 | } | ||
304 | scanreq.channelList = host2hfa384x_16(word); | ||
305 | |||
306 | /* set up the ssid, if present. */ | ||
307 | scanreq.ssid.len = host2hfa384x_16(msg->ssid.data.len); | ||
308 | memcpy(scanreq.ssid.data, msg->ssid.data.data, msg->ssid.data.len); | ||
309 | |||
310 | /* Enable the MAC port if it's not already enabled */ | ||
311 | result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_PORTSTATUS, &word); | ||
312 | if ( result ) { | ||
313 | WLAN_LOG_ERROR("getconfig(PORTSTATUS) failed. " | ||
314 | "result=%d\n", result); | ||
315 | msg->resultcode.data = | ||
316 | P80211ENUM_resultcode_implementation_failure; | ||
317 | goto exit; | ||
318 | } | ||
319 | if (word == HFA384x_PORTSTATUS_DISABLED) { | ||
320 | UINT16 wordbuf[17]; | ||
321 | |||
322 | result = hfa384x_drvr_setconfig16(hw, | ||
323 | HFA384x_RID_CNFROAMINGMODE, | ||
324 | HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM); | ||
325 | if ( result ) { | ||
326 | WLAN_LOG_ERROR("setconfig(ROAMINGMODE) failed. result=%d\n", result); | ||
327 | msg->resultcode.data = | ||
328 | P80211ENUM_resultcode_implementation_failure; | ||
329 | goto exit; | ||
330 | } | ||
331 | /* Construct a bogus SSID and assign it to OwnSSID and | ||
332 | * DesiredSSID | ||
333 | */ | ||
334 | wordbuf[0] = host2hfa384x_16(WLAN_SSID_MAXLEN); | ||
335 | get_random_bytes(&wordbuf[1], WLAN_SSID_MAXLEN); | ||
336 | result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID, | ||
337 | wordbuf, HFA384x_RID_CNFOWNSSID_LEN); | ||
338 | if ( result ) { | ||
339 | WLAN_LOG_ERROR("Failed to set OwnSSID.\n"); | ||
340 | msg->resultcode.data = | ||
341 | P80211ENUM_resultcode_implementation_failure; | ||
342 | goto exit; | ||
343 | } | ||
344 | result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFDESIREDSSID, | ||
345 | wordbuf, HFA384x_RID_CNFDESIREDSSID_LEN); | ||
346 | if ( result ) { | ||
347 | WLAN_LOG_ERROR("Failed to set DesiredSSID.\n"); | ||
348 | msg->resultcode.data = | ||
349 | P80211ENUM_resultcode_implementation_failure; | ||
350 | goto exit; | ||
351 | } | ||
352 | /* bsstype */ | ||
353 | result = hfa384x_drvr_setconfig16(hw, | ||
354 | HFA384x_RID_CNFPORTTYPE, | ||
355 | HFA384x_PORTTYPE_IBSS); | ||
356 | if ( result ) { | ||
357 | WLAN_LOG_ERROR("Failed to set CNFPORTTYPE.\n"); | ||
358 | msg->resultcode.data = | ||
359 | P80211ENUM_resultcode_implementation_failure; | ||
360 | goto exit; | ||
361 | } | ||
362 | /* ibss options */ | ||
363 | result = hfa384x_drvr_setconfig16(hw, | ||
364 | HFA384x_RID_CREATEIBSS, | ||
365 | HFA384x_CREATEIBSS_JOINCREATEIBSS); | ||
366 | if ( result ) { | ||
367 | WLAN_LOG_ERROR("Failed to set CREATEIBSS.\n"); | ||
368 | msg->resultcode.data = | ||
369 | P80211ENUM_resultcode_implementation_failure; | ||
370 | goto exit; | ||
371 | } | ||
372 | result = hfa384x_drvr_enable(hw, 0); | ||
373 | if ( result ) { | ||
374 | WLAN_LOG_ERROR("drvr_enable(0) failed. " | ||
375 | "result=%d\n", result); | ||
376 | msg->resultcode.data = | ||
377 | P80211ENUM_resultcode_implementation_failure; | ||
378 | goto exit; | ||
379 | } | ||
380 | istmpenable = 1; | ||
381 | } | ||
382 | |||
383 | /* Figure out our timeout first Kus, then HZ */ | ||
384 | timeout = msg->channellist.data.len * msg->maxchanneltime.data; | ||
385 | timeout = (timeout * HZ)/1000; | ||
386 | |||
387 | /* Issue the scan request */ | ||
388 | hw->scanflag = 0; | ||
389 | |||
390 | WLAN_HEX_DUMP(5,"hscanreq", &scanreq, sizeof(scanreq)); | ||
391 | |||
392 | result = hfa384x_drvr_setconfig( hw, | ||
393 | HFA384x_RID_HOSTSCAN, &scanreq, | ||
394 | sizeof(hfa384x_HostScanRequest_data_t)); | ||
395 | if ( result ) { | ||
396 | WLAN_LOG_ERROR("setconfig(SCANREQUEST) failed. result=%d\n", | ||
397 | result); | ||
398 | msg->resultcode.data = | ||
399 | P80211ENUM_resultcode_implementation_failure; | ||
400 | goto exit; | ||
401 | } | ||
402 | |||
403 | /* sleep until info frame arrives */ | ||
404 | wait_event_interruptible_timeout(hw->cmdq, hw->scanflag, timeout); | ||
405 | |||
406 | msg->numbss.status = P80211ENUM_msgitem_status_data_ok; | ||
407 | if (hw->scanflag == -1) | ||
408 | hw->scanflag = 0; | ||
409 | |||
410 | msg->numbss.data = hw->scanflag; | ||
411 | |||
412 | hw->scanflag = 0; | ||
413 | |||
414 | /* Disable port if we temporarily enabled it. */ | ||
415 | if (istmpenable) { | ||
416 | result = hfa384x_drvr_disable(hw, 0); | ||
417 | if ( result ) { | ||
418 | WLAN_LOG_ERROR("drvr_disable(0) failed. " | ||
419 | "result=%d\n", result); | ||
420 | msg->resultcode.data = | ||
421 | P80211ENUM_resultcode_implementation_failure; | ||
422 | goto exit; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | /* restore original roaming mode */ | ||
427 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFROAMINGMODE, | ||
428 | roamingmode); | ||
429 | if ( result ) { | ||
430 | WLAN_LOG_ERROR("setconfig(ROAMMODE) failed. result=%d\n", | ||
431 | result); | ||
432 | msg->resultcode.data = | ||
433 | P80211ENUM_resultcode_implementation_failure; | ||
434 | goto exit; | ||
435 | } | ||
436 | |||
437 | result = 0; | ||
438 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
439 | |||
440 | exit: | ||
441 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
442 | |||
443 | DBFEXIT; | ||
444 | return result; | ||
445 | } | ||
446 | |||
447 | |||
448 | /*---------------------------------------------------------------- | ||
449 | * prism2mgmt_scan_results | ||
450 | * | ||
451 | * Retrieve the BSS description for one of the BSSs identified in | ||
452 | * a scan. | ||
453 | * | ||
454 | * Arguments: | ||
455 | * wlandev wlan device structure | ||
456 | * msgp ptr to msg buffer | ||
457 | * | ||
458 | * Returns: | ||
459 | * 0 success and done | ||
460 | * <0 success, but we're waiting for something to finish. | ||
461 | * >0 an error occurred while handling the message. | ||
462 | * Side effects: | ||
463 | * | ||
464 | * Call context: | ||
465 | * process thread (usually) | ||
466 | * interrupt | ||
467 | ----------------------------------------------------------------*/ | ||
468 | int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) | ||
469 | { | ||
470 | int result = 0; | ||
471 | p80211msg_dot11req_scan_results_t *req; | ||
472 | hfa384x_t *hw = wlandev->priv; | ||
473 | hfa384x_HScanResultSub_t *item = NULL; | ||
474 | |||
475 | int count; | ||
476 | |||
477 | DBFENTER; | ||
478 | |||
479 | req = (p80211msg_dot11req_scan_results_t *) msgp; | ||
480 | |||
481 | req->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
482 | |||
483 | if (hw->ap) { | ||
484 | result = 1; | ||
485 | req->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
486 | goto exit; | ||
487 | } | ||
488 | |||
489 | if (! hw->scanresults) { | ||
490 | WLAN_LOG_ERROR("dot11req_scan_results can only be used after a successful dot11req_scan.\n"); | ||
491 | result = 2; | ||
492 | req->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
493 | goto exit; | ||
494 | } | ||
495 | |||
496 | count = (hw->scanresults->framelen - 3) / 32; | ||
497 | if (count > 32) count = 32; | ||
498 | |||
499 | if (req->bssindex.data >= count) { | ||
500 | WLAN_LOG_DEBUG(0, "requested index (%d) out of range (%d)\n", | ||
501 | req->bssindex.data, count); | ||
502 | result = 2; | ||
503 | req->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
504 | goto exit; | ||
505 | } | ||
506 | |||
507 | item = &(hw->scanresults->info.hscanresult.result[req->bssindex.data]); | ||
508 | /* signal and noise */ | ||
509 | req->signal.status = P80211ENUM_msgitem_status_data_ok; | ||
510 | req->noise.status = P80211ENUM_msgitem_status_data_ok; | ||
511 | req->signal.data = hfa384x2host_16(item->sl); | ||
512 | req->noise.data = hfa384x2host_16(item->anl); | ||
513 | |||
514 | /* BSSID */ | ||
515 | req->bssid.status = P80211ENUM_msgitem_status_data_ok; | ||
516 | req->bssid.data.len = WLAN_BSSID_LEN; | ||
517 | memcpy(req->bssid.data.data, item->bssid, WLAN_BSSID_LEN); | ||
518 | |||
519 | /* SSID */ | ||
520 | req->ssid.status = P80211ENUM_msgitem_status_data_ok; | ||
521 | req->ssid.data.len = hfa384x2host_16(item->ssid.len); | ||
522 | memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len); | ||
523 | |||
524 | /* supported rates */ | ||
525 | for (count = 0; count < 10 ; count++) | ||
526 | if (item->supprates[count] == 0) | ||
527 | break; | ||
528 | |||
529 | #define REQBASICRATE(N) \ | ||
530 | if ((count >= N) && DOT11_RATE5_ISBASIC_GET(item->supprates[(N)-1])) { \ | ||
531 | req->basicrate ## N .data = item->supprates[(N)-1]; \ | ||
532 | req->basicrate ## N .status = P80211ENUM_msgitem_status_data_ok; \ | ||
533 | } | ||
534 | |||
535 | REQBASICRATE(1); | ||
536 | REQBASICRATE(2); | ||
537 | REQBASICRATE(3); | ||
538 | REQBASICRATE(4); | ||
539 | REQBASICRATE(5); | ||
540 | REQBASICRATE(6); | ||
541 | REQBASICRATE(7); | ||
542 | REQBASICRATE(8); | ||
543 | |||
544 | #define REQSUPPRATE(N) \ | ||
545 | if (count >= N) { \ | ||
546 | req->supprate ## N .data = item->supprates[(N)-1]; \ | ||
547 | req->supprate ## N .status = P80211ENUM_msgitem_status_data_ok; \ | ||
548 | } | ||
549 | |||
550 | REQSUPPRATE(1); | ||
551 | REQSUPPRATE(2); | ||
552 | REQSUPPRATE(3); | ||
553 | REQSUPPRATE(4); | ||
554 | REQSUPPRATE(5); | ||
555 | REQSUPPRATE(6); | ||
556 | REQSUPPRATE(7); | ||
557 | REQSUPPRATE(8); | ||
558 | |||
559 | /* beacon period */ | ||
560 | req->beaconperiod.status = P80211ENUM_msgitem_status_data_ok; | ||
561 | req->beaconperiod.data = hfa384x2host_16(item->bcnint); | ||
562 | |||
563 | /* timestamps */ | ||
564 | req->timestamp.status = P80211ENUM_msgitem_status_data_ok; | ||
565 | req->timestamp.data = jiffies; | ||
566 | req->localtime.status = P80211ENUM_msgitem_status_data_ok; | ||
567 | req->localtime.data = jiffies; | ||
568 | |||
569 | /* atim window */ | ||
570 | req->ibssatimwindow.status = P80211ENUM_msgitem_status_data_ok; | ||
571 | req->ibssatimwindow.data = hfa384x2host_16(item->atim); | ||
572 | |||
573 | /* Channel */ | ||
574 | req->dschannel.status = P80211ENUM_msgitem_status_data_ok; | ||
575 | req->dschannel.data = hfa384x2host_16(item->chid); | ||
576 | |||
577 | /* capinfo bits */ | ||
578 | count = hfa384x2host_16(item->capinfo); | ||
579 | |||
580 | /* privacy flag */ | ||
581 | req->privacy.status = P80211ENUM_msgitem_status_data_ok; | ||
582 | req->privacy.data = WLAN_GET_MGMT_CAP_INFO_PRIVACY(count); | ||
583 | |||
584 | /* cfpollable */ | ||
585 | req->cfpollable.status = P80211ENUM_msgitem_status_data_ok; | ||
586 | req->cfpollable.data = WLAN_GET_MGMT_CAP_INFO_CFPOLLABLE(count); | ||
587 | |||
588 | /* cfpollreq */ | ||
589 | req->cfpollreq.status = P80211ENUM_msgitem_status_data_ok; | ||
590 | req->cfpollreq.data = WLAN_GET_MGMT_CAP_INFO_CFPOLLREQ(count); | ||
591 | |||
592 | /* bsstype */ | ||
593 | req->bsstype.status = P80211ENUM_msgitem_status_data_ok; | ||
594 | req->bsstype.data = (WLAN_GET_MGMT_CAP_INFO_ESS(count)) ? | ||
595 | P80211ENUM_bsstype_infrastructure : | ||
596 | P80211ENUM_bsstype_independent; | ||
597 | |||
598 | // item->proberesp_rate | ||
599 | /* | ||
600 | req->fhdwelltime | ||
601 | req->fhhopset | ||
602 | req->fhhoppattern | ||
603 | req->fhhopindex | ||
604 | req->cfpdurremaining | ||
605 | */ | ||
606 | |||
607 | result = 0; | ||
608 | req->resultcode.data = P80211ENUM_resultcode_success; | ||
609 | |||
610 | exit: | ||
611 | DBFEXIT; | ||
612 | return result; | ||
613 | } | ||
614 | |||
615 | |||
616 | /*---------------------------------------------------------------- | ||
617 | * prism2mgmt_join | ||
618 | * | ||
619 | * Join a BSS whose BSS description was previously obtained with | ||
620 | * a scan. | ||
621 | * | ||
622 | * Arguments: | ||
623 | * wlandev wlan device structure | ||
624 | * msgp ptr to msg buffer | ||
625 | * | ||
626 | * Returns: | ||
627 | * 0 success and done | ||
628 | * <0 success, but we're waiting for something to finish. | ||
629 | * >0 an error occurred while handling the message. | ||
630 | * Side effects: | ||
631 | * | ||
632 | * Call context: | ||
633 | * process thread (usually) | ||
634 | * interrupt | ||
635 | ----------------------------------------------------------------*/ | ||
636 | int prism2mgmt_join(wlandevice_t *wlandev, void *msgp) | ||
637 | { | ||
638 | int result = 0; | ||
639 | hfa384x_t *hw = wlandev->priv; | ||
640 | p80211msg_dot11req_join_t *msg = msgp; | ||
641 | DBFENTER; | ||
642 | |||
643 | if (!hw->ap) { | ||
644 | |||
645 | /*** STATION ***/ | ||
646 | |||
647 | /* TODO: Implement after scan */ | ||
648 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
649 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
650 | } else { | ||
651 | |||
652 | /*** ACCESS POINT ***/ | ||
653 | |||
654 | /* Never supported by APs */ | ||
655 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
656 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
657 | } | ||
658 | |||
659 | DBFEXIT; | ||
660 | return result; | ||
661 | } | ||
662 | |||
663 | |||
664 | /*---------------------------------------------------------------- | ||
665 | * prism2mgmt_p2_join | ||
666 | * | ||
667 | * Join a specific BSS | ||
668 | * | ||
669 | * Arguments: | ||
670 | * wlandev wlan device structure | ||
671 | * msgp ptr to msg buffer | ||
672 | * | ||
673 | * Returns: | ||
674 | * 0 success and done | ||
675 | * <0 success, but we're waiting for something to finish. | ||
676 | * >0 an error occurred while handling the message. | ||
677 | * Side effects: | ||
678 | * | ||
679 | * Call context: | ||
680 | * process thread (usually) | ||
681 | * interrupt | ||
682 | ----------------------------------------------------------------*/ | ||
683 | int prism2mgmt_p2_join(wlandevice_t *wlandev, void *msgp) | ||
684 | { | ||
685 | int result = 0; | ||
686 | hfa384x_t *hw = wlandev->priv; | ||
687 | p80211msg_p2req_join_t *msg = msgp; | ||
688 | UINT16 reg; | ||
689 | p80211pstrd_t *pstr; | ||
690 | UINT8 bytebuf[256]; | ||
691 | hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf; | ||
692 | hfa384x_JoinRequest_data_t joinreq; | ||
693 | DBFENTER; | ||
694 | |||
695 | if (!hw->ap) { | ||
696 | |||
697 | wlandev->macmode = WLAN_MACMODE_NONE; | ||
698 | |||
699 | /*** STATION ***/ | ||
700 | /* Set the PortType */ | ||
701 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
702 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
703 | |||
704 | /* ess port */ | ||
705 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, 1); | ||
706 | if ( result ) { | ||
707 | WLAN_LOG_ERROR("Failed to set Port Type\n"); | ||
708 | goto failed; | ||
709 | } | ||
710 | |||
711 | /* Set the auth type */ | ||
712 | if ( msg->authtype.data == P80211ENUM_authalg_sharedkey ) { | ||
713 | reg = HFA384x_CNFAUTHENTICATION_SHAREDKEY; | ||
714 | } else { | ||
715 | reg = HFA384x_CNFAUTHENTICATION_OPENSYSTEM; | ||
716 | } | ||
717 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAUTHENTICATION, reg); | ||
718 | if ( result ) { | ||
719 | WLAN_LOG_ERROR("Failed to set Authentication\n"); | ||
720 | goto failed; | ||
721 | } | ||
722 | |||
723 | /* Turn off all roaming */ | ||
724 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFROAMINGMODE, 3); | ||
725 | if ( result ) { | ||
726 | WLAN_LOG_ERROR("Failed to Turn off Roaming\n"); | ||
727 | goto failed; | ||
728 | } | ||
729 | |||
730 | /* Basic rates */ | ||
731 | reg = 0; | ||
732 | if ( msg->basicrate1.status == P80211ENUM_msgitem_status_data_ok ) { | ||
733 | reg = p80211rate_to_p2bit(msg->basicrate1.data); | ||
734 | } | ||
735 | if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) { | ||
736 | reg |= p80211rate_to_p2bit(msg->basicrate2.data); | ||
737 | } | ||
738 | if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) { | ||
739 | reg |= p80211rate_to_p2bit(msg->basicrate3.data); | ||
740 | } | ||
741 | if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) { | ||
742 | reg |= p80211rate_to_p2bit(msg->basicrate4.data); | ||
743 | } | ||
744 | if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) { | ||
745 | reg |= p80211rate_to_p2bit(msg->basicrate5.data); | ||
746 | } | ||
747 | if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) { | ||
748 | reg |= p80211rate_to_p2bit(msg->basicrate6.data); | ||
749 | } | ||
750 | if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) { | ||
751 | reg |= p80211rate_to_p2bit(msg->basicrate7.data); | ||
752 | } | ||
753 | if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) { | ||
754 | reg |= p80211rate_to_p2bit(msg->basicrate8.data); | ||
755 | } | ||
756 | if( reg == 0) | ||
757 | reg = 0x03; | ||
758 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, reg); | ||
759 | if ( result ) { | ||
760 | WLAN_LOG_ERROR("Failed to set basicrates=%d.\n", reg); | ||
761 | goto failed; | ||
762 | } | ||
763 | |||
764 | /* Operational rates (supprates and txratecontrol) */ | ||
765 | reg = 0; | ||
766 | if ( msg->operationalrate1.status == P80211ENUM_msgitem_status_data_ok ) { | ||
767 | reg = p80211rate_to_p2bit(msg->operationalrate1.data); | ||
768 | } | ||
769 | if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) { | ||
770 | reg |= p80211rate_to_p2bit(msg->operationalrate2.data); | ||
771 | } | ||
772 | if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) { | ||
773 | reg |= p80211rate_to_p2bit(msg->operationalrate3.data); | ||
774 | } | ||
775 | if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) { | ||
776 | reg |= p80211rate_to_p2bit(msg->operationalrate4.data); | ||
777 | } | ||
778 | if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) { | ||
779 | reg |= p80211rate_to_p2bit(msg->operationalrate5.data); | ||
780 | } | ||
781 | if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) { | ||
782 | reg |= p80211rate_to_p2bit(msg->operationalrate6.data); | ||
783 | } | ||
784 | if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) { | ||
785 | reg |= p80211rate_to_p2bit(msg->operationalrate7.data); | ||
786 | } | ||
787 | if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) { | ||
788 | reg |= p80211rate_to_p2bit(msg->operationalrate8.data); | ||
789 | } | ||
790 | if( reg == 0) | ||
791 | reg = 0x0f; | ||
792 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, reg); | ||
793 | if ( result ) { | ||
794 | WLAN_LOG_ERROR("Failed to set supprates=%d.\n", reg); | ||
795 | goto failed; | ||
796 | } | ||
797 | |||
798 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, reg); | ||
799 | if ( result ) { | ||
800 | WLAN_LOG_ERROR("Failed to set txrates=%d.\n", reg); | ||
801 | goto failed; | ||
802 | } | ||
803 | |||
804 | /* Set the ssid */ | ||
805 | memset(bytebuf, 0, 256); | ||
806 | pstr = (p80211pstrd_t*)&(msg->ssid.data); | ||
807 | prism2mgmt_pstr2bytestr(p2bytestr, pstr); | ||
808 | result = hfa384x_drvr_setconfig( | ||
809 | hw, HFA384x_RID_CNFDESIREDSSID, | ||
810 | bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); | ||
811 | if ( result ) { | ||
812 | WLAN_LOG_ERROR("Failed to set SSID\n"); | ||
813 | goto failed; | ||
814 | } | ||
815 | |||
816 | /* Enable the Port */ | ||
817 | result = hfa384x_cmd_enable(hw, 0); | ||
818 | if ( result ) { | ||
819 | WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result); | ||
820 | goto failed; | ||
821 | } | ||
822 | |||
823 | /* Fill in the join request */ | ||
824 | joinreq.channel = msg->channel.data; | ||
825 | memcpy( joinreq.bssid, ((unsigned char *) &msg->bssid.data) + 1, WLAN_BSSID_LEN); | ||
826 | hw->joinreq = joinreq; | ||
827 | hw->join_ap = 1; | ||
828 | |||
829 | /* Send the join request */ | ||
830 | result = hfa384x_drvr_setconfig( hw, | ||
831 | HFA384x_RID_JOINREQUEST, | ||
832 | &joinreq, HFA384x_RID_JOINREQUEST_LEN); | ||
833 | if(result != 0) { | ||
834 | WLAN_LOG_ERROR("Join request failed, result=%d.\n", result); | ||
835 | goto failed; | ||
836 | } | ||
837 | |||
838 | } else { | ||
839 | |||
840 | /*** ACCESS POINT ***/ | ||
841 | |||
842 | /* Never supported by APs */ | ||
843 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
844 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
845 | } | ||
846 | |||
847 | goto done; | ||
848 | failed: | ||
849 | WLAN_LOG_DEBUG(1, "Failed to set a config option, result=%d\n", result); | ||
850 | msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
851 | |||
852 | done: | ||
853 | result = 0; | ||
854 | |||
855 | DBFEXIT; | ||
856 | return result; | ||
857 | } | ||
858 | |||
859 | |||
860 | /*---------------------------------------------------------------- | ||
861 | * prism2mgmt_authenticate | ||
862 | * | ||
863 | * Station should be begin an authentication exchange. | ||
864 | * | ||
865 | * Arguments: | ||
866 | * wlandev wlan device structure | ||
867 | * msgp ptr to msg buffer | ||
868 | * | ||
869 | * Returns: | ||
870 | * 0 success and done | ||
871 | * <0 success, but we're waiting for something to finish. | ||
872 | * >0 an error occurred while handling the message. | ||
873 | * Side effects: | ||
874 | * | ||
875 | * Call context: | ||
876 | * process thread (usually) | ||
877 | * interrupt | ||
878 | ----------------------------------------------------------------*/ | ||
879 | int prism2mgmt_authenticate(wlandevice_t *wlandev, void *msgp) | ||
880 | { | ||
881 | int result = 0; | ||
882 | hfa384x_t *hw = wlandev->priv; | ||
883 | p80211msg_dot11req_authenticate_t *msg = msgp; | ||
884 | DBFENTER; | ||
885 | |||
886 | if (!hw->ap) { | ||
887 | |||
888 | /*** STATION ***/ | ||
889 | |||
890 | /* TODO: Decide how we're going to handle this one w/ Prism2 */ | ||
891 | /* It could be entertaining since Prism2 doesn't have */ | ||
892 | /* an explicit way to control this */ | ||
893 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
894 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
895 | } else { | ||
896 | |||
897 | /*** ACCESS POINT ***/ | ||
898 | |||
899 | /* Never supported by APs */ | ||
900 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
901 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
902 | } | ||
903 | |||
904 | DBFEXIT; | ||
905 | return result; | ||
906 | } | ||
907 | |||
908 | |||
909 | /*---------------------------------------------------------------- | ||
910 | * prism2mgmt_deauthenticate | ||
911 | * | ||
912 | * Send a deauthenticate notification. | ||
913 | * | ||
914 | * Arguments: | ||
915 | * wlandev wlan device structure | ||
916 | * msgp ptr to msg buffer | ||
917 | * | ||
918 | * Returns: | ||
919 | * 0 success and done | ||
920 | * <0 success, but we're waiting for something to finish. | ||
921 | * >0 an error occurred while handling the message. | ||
922 | * Side effects: | ||
923 | * | ||
924 | * Call context: | ||
925 | * process thread (usually) | ||
926 | * interrupt | ||
927 | ----------------------------------------------------------------*/ | ||
928 | int prism2mgmt_deauthenticate(wlandevice_t *wlandev, void *msgp) | ||
929 | { | ||
930 | int result = 0; | ||
931 | hfa384x_t *hw = wlandev->priv; | ||
932 | p80211msg_dot11req_deauthenticate_t *msg = msgp; | ||
933 | DBFENTER; | ||
934 | |||
935 | if (!hw->ap) { | ||
936 | |||
937 | /*** STATION ***/ | ||
938 | |||
939 | /* TODO: Decide how we're going to handle this one w/ Prism2 */ | ||
940 | /* It could be entertaining since Prism2 doesn't have */ | ||
941 | /* an explicit way to control this */ | ||
942 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
943 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
944 | } else { | ||
945 | |||
946 | /*** ACCESS POINT ***/ | ||
947 | hfa384x_drvr_handover(hw, msg->peerstaaddress.data.data); | ||
948 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
949 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
950 | } | ||
951 | |||
952 | DBFEXIT; | ||
953 | return result; | ||
954 | } | ||
955 | |||
956 | |||
957 | /*---------------------------------------------------------------- | ||
958 | * prism2mgmt_associate | ||
959 | * | ||
960 | * Associate with an ESS. | ||
961 | * | ||
962 | * Arguments: | ||
963 | * wlandev wlan device structure | ||
964 | * msgp ptr to msg buffer | ||
965 | * | ||
966 | * Returns: | ||
967 | * 0 success and done | ||
968 | * <0 success, but we're waiting for something to finish. | ||
969 | * >0 an error occurred while handling the message. | ||
970 | * Side effects: | ||
971 | * | ||
972 | * Call context: | ||
973 | * process thread (usually) | ||
974 | * interrupt | ||
975 | ----------------------------------------------------------------*/ | ||
976 | int prism2mgmt_associate(wlandevice_t *wlandev, void *msgp) | ||
977 | { | ||
978 | hfa384x_t *hw = wlandev->priv; | ||
979 | int result = 0; | ||
980 | p80211msg_dot11req_associate_t *msg = msgp; | ||
981 | DBFENTER; | ||
982 | |||
983 | if (!hw->ap) { | ||
984 | |||
985 | /*** STATION ***/ | ||
986 | |||
987 | #if 0 | ||
988 | /* Set the TxRates */ | ||
989 | reg = 0x000f; | ||
990 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, reg); | ||
991 | #endif | ||
992 | |||
993 | /* Set the PortType */ | ||
994 | /* ess port */ | ||
995 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, 1); | ||
996 | |||
997 | /* Enable the Port */ | ||
998 | hfa384x_drvr_enable(hw, 0); | ||
999 | |||
1000 | /* Set the resultcode */ | ||
1001 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1002 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1003 | |||
1004 | } else { | ||
1005 | |||
1006 | /*** ACCESS POINT ***/ | ||
1007 | |||
1008 | /* Never supported on AP */ | ||
1009 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1010 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1011 | } | ||
1012 | |||
1013 | DBFEXIT; | ||
1014 | return result; | ||
1015 | } | ||
1016 | |||
1017 | |||
1018 | /*---------------------------------------------------------------- | ||
1019 | * prism2mgmt_reassociate | ||
1020 | * | ||
1021 | * Renew association because of a BSS change. | ||
1022 | * | ||
1023 | * Arguments: | ||
1024 | * wlandev wlan device structure | ||
1025 | * msgp ptr to msg buffer | ||
1026 | * | ||
1027 | * Returns: | ||
1028 | * 0 success and done | ||
1029 | * <0 success, but we're waiting for something to finish. | ||
1030 | * >0 an error occurred while handling the message. | ||
1031 | * Side effects: | ||
1032 | * | ||
1033 | * Call context: | ||
1034 | * process thread (usually) | ||
1035 | * interrupt | ||
1036 | ----------------------------------------------------------------*/ | ||
1037 | int prism2mgmt_reassociate(wlandevice_t *wlandev, void *msgp) | ||
1038 | { | ||
1039 | int result = 0; | ||
1040 | hfa384x_t *hw = wlandev->priv; | ||
1041 | p80211msg_dot11req_reassociate_t *msg = msgp; | ||
1042 | DBFENTER; | ||
1043 | |||
1044 | if (!hw->ap) { | ||
1045 | |||
1046 | /*** STATION ***/ | ||
1047 | |||
1048 | /* TODO: Not supported yet...not sure how we're going to do it */ | ||
1049 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1050 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1051 | } else { | ||
1052 | |||
1053 | /*** ACCESS POINT ***/ | ||
1054 | |||
1055 | /* Never supported on AP */ | ||
1056 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1057 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1058 | } | ||
1059 | |||
1060 | DBFEXIT; | ||
1061 | return result; | ||
1062 | } | ||
1063 | |||
1064 | |||
1065 | /*---------------------------------------------------------------- | ||
1066 | * prism2mgmt_disassociate | ||
1067 | * | ||
1068 | * Send a disassociation notification. | ||
1069 | * | ||
1070 | * Arguments: | ||
1071 | * wlandev wlan device structure | ||
1072 | * msgp ptr to msg buffer | ||
1073 | * | ||
1074 | * Returns: | ||
1075 | * 0 success and done | ||
1076 | * <0 success, but we're waiting for something to finish. | ||
1077 | * >0 an error occurred while handling the message. | ||
1078 | * Side effects: | ||
1079 | * | ||
1080 | * Call context: | ||
1081 | * process thread (usually) | ||
1082 | * interrupt | ||
1083 | ----------------------------------------------------------------*/ | ||
1084 | int prism2mgmt_disassociate(wlandevice_t *wlandev, void *msgp) | ||
1085 | { | ||
1086 | int result = 0; | ||
1087 | hfa384x_t *hw = wlandev->priv; | ||
1088 | p80211msg_dot11req_disassociate_t *msg = msgp; | ||
1089 | DBFENTER; | ||
1090 | |||
1091 | if (!hw->ap) { | ||
1092 | |||
1093 | /*** STATION ***/ | ||
1094 | |||
1095 | /* TODO: Not supported yet...not sure how to do it */ | ||
1096 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1097 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1098 | } else { | ||
1099 | |||
1100 | /*** ACCESS POINT ***/ | ||
1101 | hfa384x_drvr_handover(hw, msg->peerstaaddress.data.data); | ||
1102 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1103 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1104 | } | ||
1105 | |||
1106 | DBFEXIT; | ||
1107 | return result; | ||
1108 | } | ||
1109 | |||
1110 | |||
1111 | /*---------------------------------------------------------------- | ||
1112 | * prism2mgmt_reset | ||
1113 | * | ||
1114 | * Reset the MAC and MSD. The p80211 layer has it's own handling | ||
1115 | * that should be done before and after this function. | ||
1116 | * Procedure: | ||
1117 | * - disable system interrupts ?? | ||
1118 | * - disable MAC interrupts | ||
1119 | * - restore system interrupts | ||
1120 | * - issue the MAC initialize command | ||
1121 | * - clear any MSD level state (including timers, queued events, | ||
1122 | * etc.). Note that if we're removing timer'd/queue events, we may | ||
1123 | * need to have remained in the system interrupt disabled state. | ||
1124 | * We should be left in the same state that we're in following | ||
1125 | * driver initialization. | ||
1126 | * | ||
1127 | * Arguments: | ||
1128 | * wlandev wlan device structure | ||
1129 | * msgp ptr to msg buffer, MAY BE NULL! for a driver local | ||
1130 | * call. | ||
1131 | * | ||
1132 | * Returns: | ||
1133 | * 0 success and done | ||
1134 | * <0 success, but we're waiting for something to finish. | ||
1135 | * >0 an error occurred while handling the message. | ||
1136 | * Side effects: | ||
1137 | * | ||
1138 | * Call context: | ||
1139 | * process thread, commonly wlanctl, but might be rmmod/pci_close. | ||
1140 | ----------------------------------------------------------------*/ | ||
1141 | int prism2mgmt_reset(wlandevice_t *wlandev, void *msgp) | ||
1142 | { | ||
1143 | int result = 0; | ||
1144 | hfa384x_t *hw = wlandev->priv; | ||
1145 | p80211msg_dot11req_reset_t *msg = msgp; | ||
1146 | DBFENTER; | ||
1147 | |||
1148 | /* | ||
1149 | * This is supported on both AP and STA and it's not allowed | ||
1150 | * to fail. | ||
1151 | */ | ||
1152 | if ( msgp ) { | ||
1153 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1154 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1155 | WLAN_LOG_INFO("dot11req_reset: the macaddress and " | ||
1156 | "setdefaultmib arguments are currently unsupported.\n"); | ||
1157 | } | ||
1158 | |||
1159 | /* | ||
1160 | * If we got this far, the MSD must be in the MSDRUNNING state | ||
1161 | * therefore, we must stop and then restart the hw/MAC combo. | ||
1162 | */ | ||
1163 | hfa384x_drvr_stop(hw); | ||
1164 | result = hfa384x_drvr_start(hw); | ||
1165 | if (result != 0) { | ||
1166 | WLAN_LOG_ERROR("dot11req_reset: Initialize command failed," | ||
1167 | " bad things will happen from here.\n"); | ||
1168 | return 0; | ||
1169 | } | ||
1170 | |||
1171 | DBFEXIT; | ||
1172 | return 0; | ||
1173 | } | ||
1174 | |||
1175 | |||
1176 | /*---------------------------------------------------------------- | ||
1177 | * prism2mgmt_start | ||
1178 | * | ||
1179 | * Start a BSS. Any station can do this for IBSS, only AP for ESS. | ||
1180 | * | ||
1181 | * Arguments: | ||
1182 | * wlandev wlan device structure | ||
1183 | * msgp ptr to msg buffer | ||
1184 | * | ||
1185 | * Returns: | ||
1186 | * 0 success and done | ||
1187 | * <0 success, but we're waiting for something to finish. | ||
1188 | * >0 an error occurred while handling the message. | ||
1189 | * Side effects: | ||
1190 | * | ||
1191 | * Call context: | ||
1192 | * process thread (usually) | ||
1193 | * interrupt | ||
1194 | ----------------------------------------------------------------*/ | ||
1195 | int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) | ||
1196 | { | ||
1197 | int result = 0; | ||
1198 | hfa384x_t *hw = wlandev->priv; | ||
1199 | p80211msg_dot11req_start_t *msg = msgp; | ||
1200 | |||
1201 | p80211pstrd_t *pstr; | ||
1202 | UINT8 bytebuf[80]; | ||
1203 | hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf; | ||
1204 | hfa384x_PCFInfo_data_t *pcfinfo = (hfa384x_PCFInfo_data_t*)bytebuf; | ||
1205 | UINT16 word; | ||
1206 | DBFENTER; | ||
1207 | |||
1208 | wlandev->macmode = WLAN_MACMODE_NONE; | ||
1209 | |||
1210 | /* Set the SSID */ | ||
1211 | memcpy(&wlandev->ssid, &msg->ssid.data, sizeof(msg->ssid.data)); | ||
1212 | |||
1213 | if (!hw->ap) { | ||
1214 | /*** ADHOC IBSS ***/ | ||
1215 | /* see if current f/w is less than 8c3 */ | ||
1216 | if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, | ||
1217 | hw->ident_sta_fw.minor, | ||
1218 | hw->ident_sta_fw.variant) < | ||
1219 | HFA384x_FIRMWARE_VERSION(0,8,3)) { | ||
1220 | /* Ad-Hoc not quite supported on Prism2 */ | ||
1221 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1222 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1223 | goto done; | ||
1224 | } | ||
1225 | |||
1226 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1227 | |||
1228 | /*** STATION ***/ | ||
1229 | /* Set the REQUIRED config items */ | ||
1230 | /* SSID */ | ||
1231 | pstr = (p80211pstrd_t*)&(msg->ssid.data); | ||
1232 | prism2mgmt_pstr2bytestr(p2bytestr, pstr); | ||
1233 | result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID, | ||
1234 | bytebuf, HFA384x_RID_CNFOWNSSID_LEN); | ||
1235 | if ( result ) { | ||
1236 | WLAN_LOG_ERROR("Failed to set CnfOwnSSID\n"); | ||
1237 | goto failed; | ||
1238 | } | ||
1239 | result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFDESIREDSSID, | ||
1240 | bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); | ||
1241 | if ( result ) { | ||
1242 | WLAN_LOG_ERROR("Failed to set CnfDesiredSSID\n"); | ||
1243 | goto failed; | ||
1244 | } | ||
1245 | |||
1246 | /* bsstype - we use the default in the ap firmware */ | ||
1247 | /* IBSS port */ | ||
1248 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, 0); | ||
1249 | |||
1250 | /* beacon period */ | ||
1251 | word = msg->beaconperiod.data; | ||
1252 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNINT, word); | ||
1253 | if ( result ) { | ||
1254 | WLAN_LOG_ERROR("Failed to set beacon period=%d.\n", word); | ||
1255 | goto failed; | ||
1256 | } | ||
1257 | |||
1258 | /* dschannel */ | ||
1259 | word = msg->dschannel.data; | ||
1260 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNCHANNEL, word); | ||
1261 | if ( result ) { | ||
1262 | WLAN_LOG_ERROR("Failed to set channel=%d.\n", word); | ||
1263 | goto failed; | ||
1264 | } | ||
1265 | /* Basic rates */ | ||
1266 | word = p80211rate_to_p2bit(msg->basicrate1.data); | ||
1267 | if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1268 | word |= p80211rate_to_p2bit(msg->basicrate2.data); | ||
1269 | } | ||
1270 | if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1271 | word |= p80211rate_to_p2bit(msg->basicrate3.data); | ||
1272 | } | ||
1273 | if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1274 | word |= p80211rate_to_p2bit(msg->basicrate4.data); | ||
1275 | } | ||
1276 | if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1277 | word |= p80211rate_to_p2bit(msg->basicrate5.data); | ||
1278 | } | ||
1279 | if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1280 | word |= p80211rate_to_p2bit(msg->basicrate6.data); | ||
1281 | } | ||
1282 | if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1283 | word |= p80211rate_to_p2bit(msg->basicrate7.data); | ||
1284 | } | ||
1285 | if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1286 | word |= p80211rate_to_p2bit(msg->basicrate8.data); | ||
1287 | } | ||
1288 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, word); | ||
1289 | if ( result ) { | ||
1290 | WLAN_LOG_ERROR("Failed to set basicrates=%d.\n", word); | ||
1291 | goto failed; | ||
1292 | } | ||
1293 | |||
1294 | /* Operational rates (supprates and txratecontrol) */ | ||
1295 | word = p80211rate_to_p2bit(msg->operationalrate1.data); | ||
1296 | if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1297 | word |= p80211rate_to_p2bit(msg->operationalrate2.data); | ||
1298 | } | ||
1299 | if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1300 | word |= p80211rate_to_p2bit(msg->operationalrate3.data); | ||
1301 | } | ||
1302 | if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1303 | word |= p80211rate_to_p2bit(msg->operationalrate4.data); | ||
1304 | } | ||
1305 | if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1306 | word |= p80211rate_to_p2bit(msg->operationalrate5.data); | ||
1307 | } | ||
1308 | if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1309 | word |= p80211rate_to_p2bit(msg->operationalrate6.data); | ||
1310 | } | ||
1311 | if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1312 | word |= p80211rate_to_p2bit(msg->operationalrate7.data); | ||
1313 | } | ||
1314 | if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1315 | word |= p80211rate_to_p2bit(msg->operationalrate8.data); | ||
1316 | } | ||
1317 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, word); | ||
1318 | if ( result ) { | ||
1319 | WLAN_LOG_ERROR("Failed to set supprates=%d.\n", word); | ||
1320 | goto failed; | ||
1321 | } | ||
1322 | |||
1323 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, word); | ||
1324 | if ( result ) { | ||
1325 | WLAN_LOG_ERROR("Failed to set txrates=%d.\n", word); | ||
1326 | goto failed; | ||
1327 | } | ||
1328 | |||
1329 | /* Set the macmode so the frame setup code knows what to do */ | ||
1330 | if ( msg->bsstype.data == P80211ENUM_bsstype_independent ) { | ||
1331 | wlandev->macmode = WLAN_MACMODE_IBSS_STA; | ||
1332 | /* lets extend the data length a bit */ | ||
1333 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, 2304); | ||
1334 | } | ||
1335 | |||
1336 | /* Enable the Port */ | ||
1337 | result = hfa384x_drvr_enable(hw, 0); | ||
1338 | if ( result ) { | ||
1339 | WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result); | ||
1340 | goto failed; | ||
1341 | } | ||
1342 | |||
1343 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1344 | |||
1345 | goto done; | ||
1346 | } | ||
1347 | |||
1348 | /*** ACCESS POINT ***/ | ||
1349 | |||
1350 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1351 | |||
1352 | /* Validate the command, if BSStype=infra is the tertiary loaded? */ | ||
1353 | if ( msg->bsstype.data == P80211ENUM_bsstype_independent ) { | ||
1354 | WLAN_LOG_ERROR("AP driver cannot create IBSS.\n"); | ||
1355 | goto failed; | ||
1356 | } else if ( hw->cap_sup_sta.id != 5) { | ||
1357 | WLAN_LOG_ERROR("AP driver failed to detect AP firmware.\n"); | ||
1358 | goto failed; | ||
1359 | } | ||
1360 | |||
1361 | /* Set the REQUIRED config items */ | ||
1362 | /* SSID */ | ||
1363 | pstr = (p80211pstrd_t*)&(msg->ssid.data); | ||
1364 | prism2mgmt_pstr2bytestr(p2bytestr, pstr); | ||
1365 | result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CNFOWNSSID, | ||
1366 | bytebuf, HFA384x_RID_CNFOWNSSID_LEN); | ||
1367 | if ( result ) { | ||
1368 | WLAN_LOG_ERROR("Failed to set SSID, result=0x%04x\n", result); | ||
1369 | goto failed; | ||
1370 | } | ||
1371 | |||
1372 | /* bsstype - we use the default in the ap firmware */ | ||
1373 | |||
1374 | /* beacon period */ | ||
1375 | word = msg->beaconperiod.data; | ||
1376 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNINT, word); | ||
1377 | if ( result ) { | ||
1378 | WLAN_LOG_ERROR("Failed to set beacon period=%d.\n", word); | ||
1379 | goto failed; | ||
1380 | } | ||
1381 | |||
1382 | /* dschannel */ | ||
1383 | word = msg->dschannel.data; | ||
1384 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNCHANNEL, word); | ||
1385 | if ( result ) { | ||
1386 | WLAN_LOG_ERROR("Failed to set channel=%d.\n", word); | ||
1387 | goto failed; | ||
1388 | } | ||
1389 | /* Basic rates */ | ||
1390 | word = p80211rate_to_p2bit(msg->basicrate1.data); | ||
1391 | if ( msg->basicrate2.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1392 | word |= p80211rate_to_p2bit(msg->basicrate2.data); | ||
1393 | } | ||
1394 | if ( msg->basicrate3.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1395 | word |= p80211rate_to_p2bit(msg->basicrate3.data); | ||
1396 | } | ||
1397 | if ( msg->basicrate4.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1398 | word |= p80211rate_to_p2bit(msg->basicrate4.data); | ||
1399 | } | ||
1400 | if ( msg->basicrate5.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1401 | word |= p80211rate_to_p2bit(msg->basicrate5.data); | ||
1402 | } | ||
1403 | if ( msg->basicrate6.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1404 | word |= p80211rate_to_p2bit(msg->basicrate6.data); | ||
1405 | } | ||
1406 | if ( msg->basicrate7.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1407 | word |= p80211rate_to_p2bit(msg->basicrate7.data); | ||
1408 | } | ||
1409 | if ( msg->basicrate8.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1410 | word |= p80211rate_to_p2bit(msg->basicrate8.data); | ||
1411 | } | ||
1412 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, word); | ||
1413 | if ( result ) { | ||
1414 | WLAN_LOG_ERROR("Failed to set basicrates=%d.\n", word); | ||
1415 | goto failed; | ||
1416 | } | ||
1417 | |||
1418 | /* Operational rates (supprates and txratecontrol) */ | ||
1419 | word = p80211rate_to_p2bit(msg->operationalrate1.data); | ||
1420 | if ( msg->operationalrate2.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1421 | word |= p80211rate_to_p2bit(msg->operationalrate2.data); | ||
1422 | } | ||
1423 | if ( msg->operationalrate3.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1424 | word |= p80211rate_to_p2bit(msg->operationalrate3.data); | ||
1425 | } | ||
1426 | if ( msg->operationalrate4.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1427 | word |= p80211rate_to_p2bit(msg->operationalrate4.data); | ||
1428 | } | ||
1429 | if ( msg->operationalrate5.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1430 | word |= p80211rate_to_p2bit(msg->operationalrate5.data); | ||
1431 | } | ||
1432 | if ( msg->operationalrate6.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1433 | word |= p80211rate_to_p2bit(msg->operationalrate6.data); | ||
1434 | } | ||
1435 | if ( msg->operationalrate7.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1436 | word |= p80211rate_to_p2bit(msg->operationalrate7.data); | ||
1437 | } | ||
1438 | if ( msg->operationalrate8.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1439 | word |= p80211rate_to_p2bit(msg->operationalrate8.data); | ||
1440 | } | ||
1441 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, word); | ||
1442 | if ( result ) { | ||
1443 | WLAN_LOG_ERROR("Failed to set supprates=%d.\n", word); | ||
1444 | goto failed; | ||
1445 | } | ||
1446 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL0, word); | ||
1447 | if ( result ) { | ||
1448 | WLAN_LOG_ERROR("Failed to set txrates=%d.\n", word); | ||
1449 | goto failed; | ||
1450 | } | ||
1451 | |||
1452 | /* ibssatimwindow */ | ||
1453 | if (msg->ibssatimwindow.status == P80211ENUM_msgitem_status_data_ok) { | ||
1454 | WLAN_LOG_INFO("prism2mgmt_start: atimwindow not used in " | ||
1455 | "Infrastructure mode, ignored.\n"); | ||
1456 | } | ||
1457 | |||
1458 | /* DTIM period */ | ||
1459 | word = msg->dtimperiod.data; | ||
1460 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNDTIMPER, word); | ||
1461 | if ( result ) { | ||
1462 | WLAN_LOG_ERROR("Failed to set dtim period=%d.\n", word); | ||
1463 | goto failed; | ||
1464 | } | ||
1465 | |||
1466 | /* probedelay */ | ||
1467 | if (msg->probedelay.status == P80211ENUM_msgitem_status_data_ok) { | ||
1468 | WLAN_LOG_INFO("prism2mgmt_start: probedelay not " | ||
1469 | "supported in prism2, ignored.\n"); | ||
1470 | } | ||
1471 | |||
1472 | /* cfpollable, cfpollreq, cfpperiod, cfpmaxduration */ | ||
1473 | if (msg->cfpollable.data == P80211ENUM_truth_true && | ||
1474 | msg->cfpollreq.data == P80211ENUM_truth_true ) { | ||
1475 | WLAN_LOG_ERROR("cfpollable=cfpollreq=true is illegal.\n"); | ||
1476 | result = -1; | ||
1477 | goto failed; | ||
1478 | } | ||
1479 | |||
1480 | /* read the PCFInfo and update */ | ||
1481 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFAPPCFINFO, | ||
1482 | pcfinfo, HFA384x_RID_CNFAPPCFINFO_LEN); | ||
1483 | if ( result ) { | ||
1484 | WLAN_LOG_INFO("prism2mgmt_start: read(pcfinfo) failed, " | ||
1485 | "assume it's " | ||
1486 | "not supported, pcf settings ignored.\n"); | ||
1487 | goto pcf_skip; | ||
1488 | } | ||
1489 | if ((msg->cfpollable.data == P80211ENUM_truth_false && | ||
1490 | msg->cfpollreq.data == P80211ENUM_truth_false) ) { | ||
1491 | pcfinfo->MediumOccupancyLimit = 0; | ||
1492 | pcfinfo->CFPPeriod = 0; | ||
1493 | pcfinfo->CFPMaxDuration = 0; | ||
1494 | pcfinfo->CFPFlags &= host2hfa384x_16((UINT16)~BIT0); | ||
1495 | |||
1496 | if ( msg->cfpperiod.status == P80211ENUM_msgitem_status_data_ok || | ||
1497 | msg->cfpmaxduration.status == P80211ENUM_msgitem_status_data_ok ) { | ||
1498 | WLAN_LOG_WARNING( | ||
1499 | "Setting cfpperiod or cfpmaxduration when " | ||
1500 | "cfpollable and cfreq are false is pointless.\n"); | ||
1501 | } | ||
1502 | } | ||
1503 | if ((msg->cfpollable.data == P80211ENUM_truth_true || | ||
1504 | msg->cfpollreq.data == P80211ENUM_truth_true) ) { | ||
1505 | if ( msg->cfpollable.data == P80211ENUM_truth_true) { | ||
1506 | pcfinfo->CFPFlags |= host2hfa384x_16((UINT16)BIT0); | ||
1507 | } | ||
1508 | |||
1509 | if ( msg->cfpperiod.status == P80211ENUM_msgitem_status_data_ok) { | ||
1510 | pcfinfo->CFPPeriod = msg->cfpperiod.data; | ||
1511 | pcfinfo->CFPPeriod = host2hfa384x_16(pcfinfo->CFPPeriod); | ||
1512 | } | ||
1513 | |||
1514 | if ( msg->cfpmaxduration.status == P80211ENUM_msgitem_status_data_ok) { | ||
1515 | pcfinfo->CFPMaxDuration = msg->cfpmaxduration.data; | ||
1516 | pcfinfo->CFPMaxDuration = host2hfa384x_16(pcfinfo->CFPMaxDuration); | ||
1517 | pcfinfo->MediumOccupancyLimit = pcfinfo->CFPMaxDuration; | ||
1518 | } | ||
1519 | } | ||
1520 | result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFAPPCFINFO, | ||
1521 | pcfinfo, HFA384x_RID_CNFAPPCFINFO_LEN); | ||
1522 | if ( result ) { | ||
1523 | WLAN_LOG_ERROR("write(pcfinfo) failed.\n"); | ||
1524 | goto failed; | ||
1525 | } | ||
1526 | |||
1527 | pcf_skip: | ||
1528 | /* Set the macmode so the frame setup code knows what to do */ | ||
1529 | if ( msg->bsstype.data == P80211ENUM_bsstype_infrastructure ) { | ||
1530 | wlandev->macmode = WLAN_MACMODE_ESS_AP; | ||
1531 | /* lets extend the data length a bit */ | ||
1532 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, 2304); | ||
1533 | } | ||
1534 | |||
1535 | /* Set the BSSID to the same as our MAC */ | ||
1536 | memcpy( wlandev->bssid, wlandev->netdev->dev_addr, WLAN_BSSID_LEN); | ||
1537 | |||
1538 | /* Enable the Port */ | ||
1539 | result = hfa384x_drvr_enable(hw, 0); | ||
1540 | if ( result ) { | ||
1541 | WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result); | ||
1542 | goto failed; | ||
1543 | } | ||
1544 | |||
1545 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1546 | |||
1547 | goto done; | ||
1548 | failed: | ||
1549 | WLAN_LOG_DEBUG(1, "Failed to set a config option, result=%d\n", result); | ||
1550 | msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
1551 | |||
1552 | done: | ||
1553 | result = 0; | ||
1554 | |||
1555 | DBFEXIT; | ||
1556 | return result; | ||
1557 | } | ||
1558 | |||
1559 | |||
1560 | /*---------------------------------------------------------------- | ||
1561 | * prism2mgmt_enable | ||
1562 | * | ||
1563 | * Start a BSS. Any station can do this for IBSS, only AP for ESS. | ||
1564 | * | ||
1565 | * Arguments: | ||
1566 | * wlandev wlan device structure | ||
1567 | * msgp ptr to msg buffer | ||
1568 | * | ||
1569 | * Returns: | ||
1570 | * 0 success and done | ||
1571 | * <0 success, but we're waiting for something to finish. | ||
1572 | * >0 an error occurred while handling the message. | ||
1573 | * Side effects: | ||
1574 | * | ||
1575 | * Call context: | ||
1576 | * process thread (usually) | ||
1577 | * interrupt | ||
1578 | ----------------------------------------------------------------*/ | ||
1579 | int prism2mgmt_enable(wlandevice_t *wlandev, void *msgp) | ||
1580 | { | ||
1581 | int result = 0; | ||
1582 | hfa384x_t *hw = wlandev->priv; | ||
1583 | p80211msg_p2req_enable_t *msg = msgp; | ||
1584 | DBFENTER; | ||
1585 | |||
1586 | if (!hw->ap) { | ||
1587 | |||
1588 | /*** STATION ***/ | ||
1589 | |||
1590 | /* Ad-Hoc not quite supported on Prism2 */ | ||
1591 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1592 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1593 | goto done; | ||
1594 | } | ||
1595 | |||
1596 | /*** ACCESS POINT ***/ | ||
1597 | |||
1598 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1599 | |||
1600 | /* Is the tertiary loaded? */ | ||
1601 | if ( hw->cap_sup_sta.id != 5) { | ||
1602 | WLAN_LOG_ERROR("AP driver failed to detect AP firmware.\n"); | ||
1603 | goto failed; | ||
1604 | } | ||
1605 | |||
1606 | /* Set the macmode so the frame setup code knows what to do */ | ||
1607 | wlandev->macmode = WLAN_MACMODE_ESS_AP; | ||
1608 | |||
1609 | /* Set the BSSID to the same as our MAC */ | ||
1610 | memcpy( wlandev->bssid, wlandev->netdev->dev_addr, WLAN_BSSID_LEN); | ||
1611 | |||
1612 | /* Enable the Port */ | ||
1613 | result = hfa384x_drvr_enable(hw, 0); | ||
1614 | if ( result ) { | ||
1615 | WLAN_LOG_ERROR("Enable macport failed, result=%d.\n", result); | ||
1616 | goto failed; | ||
1617 | } | ||
1618 | |||
1619 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1620 | |||
1621 | goto done; | ||
1622 | failed: | ||
1623 | msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
1624 | |||
1625 | done: | ||
1626 | result = 0; | ||
1627 | |||
1628 | DBFEXIT; | ||
1629 | return result; | ||
1630 | } | ||
1631 | |||
1632 | |||
1633 | /*---------------------------------------------------------------- | ||
1634 | * prism2mgmt_readpda | ||
1635 | * | ||
1636 | * Collect the PDA data and put it in the message. | ||
1637 | * | ||
1638 | * Arguments: | ||
1639 | * wlandev wlan device structure | ||
1640 | * msgp ptr to msg buffer | ||
1641 | * | ||
1642 | * Returns: | ||
1643 | * 0 success and done | ||
1644 | * <0 success, but we're waiting for something to finish. | ||
1645 | * >0 an error occurred while handling the message. | ||
1646 | * Side effects: | ||
1647 | * | ||
1648 | * Call context: | ||
1649 | * process thread (usually) | ||
1650 | ----------------------------------------------------------------*/ | ||
1651 | int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) | ||
1652 | { | ||
1653 | hfa384x_t *hw = wlandev->priv; | ||
1654 | p80211msg_p2req_readpda_t *msg = msgp; | ||
1655 | int result; | ||
1656 | DBFENTER; | ||
1657 | |||
1658 | /* We only support collecting the PDA when in the FWLOAD | ||
1659 | * state. | ||
1660 | */ | ||
1661 | if (wlandev->msdstate != WLAN_MSD_FWLOAD) { | ||
1662 | WLAN_LOG_ERROR( | ||
1663 | "PDA may only be read " | ||
1664 | "in the fwload state.\n"); | ||
1665 | msg->resultcode.data = | ||
1666 | P80211ENUM_resultcode_implementation_failure; | ||
1667 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1668 | } else { | ||
1669 | /* Call drvr_readpda(), it handles the auxport enable | ||
1670 | * and validating the returned PDA. | ||
1671 | */ | ||
1672 | result = hfa384x_drvr_readpda( | ||
1673 | hw, | ||
1674 | msg->pda.data, | ||
1675 | HFA384x_PDA_LEN_MAX); | ||
1676 | if (result) { | ||
1677 | WLAN_LOG_ERROR( | ||
1678 | "hfa384x_drvr_readpda() failed, " | ||
1679 | "result=%d\n", | ||
1680 | result); | ||
1681 | |||
1682 | msg->resultcode.data = | ||
1683 | P80211ENUM_resultcode_implementation_failure; | ||
1684 | msg->resultcode.status = | ||
1685 | P80211ENUM_msgitem_status_data_ok; | ||
1686 | DBFEXIT; | ||
1687 | return 0; | ||
1688 | } | ||
1689 | msg->pda.status = P80211ENUM_msgitem_status_data_ok; | ||
1690 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1691 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1692 | } | ||
1693 | |||
1694 | DBFEXIT; | ||
1695 | return 0; | ||
1696 | } | ||
1697 | |||
1698 | /*---------------------------------------------------------------- | ||
1699 | * prism2mgmt_readcis | ||
1700 | * | ||
1701 | * Collect the CIS data and put it in the message. | ||
1702 | * | ||
1703 | * Arguments: | ||
1704 | * wlandev wlan device structure | ||
1705 | * msgp ptr to msg buffer | ||
1706 | * | ||
1707 | * Returns: | ||
1708 | * 0 success and done | ||
1709 | * <0 success, but we're waiting for something to finish. | ||
1710 | * >0 an error occurred while handling the message. | ||
1711 | * Side effects: | ||
1712 | * | ||
1713 | * Call context: | ||
1714 | * process thread (usually) | ||
1715 | ----------------------------------------------------------------*/ | ||
1716 | int prism2mgmt_readcis(wlandevice_t *wlandev, void *msgp) | ||
1717 | { | ||
1718 | int result; | ||
1719 | hfa384x_t *hw = wlandev->priv; | ||
1720 | p80211msg_p2req_readcis_t *msg = msgp; | ||
1721 | |||
1722 | DBFENTER; | ||
1723 | |||
1724 | memset(msg->cis.data, 0, sizeof(msg->cis.data)); | ||
1725 | |||
1726 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CIS, | ||
1727 | msg->cis.data, HFA384x_RID_CIS_LEN); | ||
1728 | if ( result ) { | ||
1729 | WLAN_LOG_INFO("prism2mgmt_readcis: read(cis) failed.\n"); | ||
1730 | msg->cis.status = P80211ENUM_msgitem_status_no_value; | ||
1731 | msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; | ||
1732 | |||
1733 | } | ||
1734 | else { | ||
1735 | msg->cis.status = P80211ENUM_msgitem_status_data_ok; | ||
1736 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1737 | } | ||
1738 | |||
1739 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1740 | |||
1741 | DBFEXIT; | ||
1742 | return 0; | ||
1743 | } | ||
1744 | |||
1745 | /*---------------------------------------------------------------- | ||
1746 | * prism2mgmt_auxport_state | ||
1747 | * | ||
1748 | * Enables/Disables the card's auxiliary port. Should be called | ||
1749 | * before and after a sequence of auxport_read()/auxport_write() | ||
1750 | * calls. | ||
1751 | * | ||
1752 | * Arguments: | ||
1753 | * wlandev wlan device structure | ||
1754 | * msgp ptr to msg buffer | ||
1755 | * | ||
1756 | * Returns: | ||
1757 | * 0 success and done | ||
1758 | * <0 success, but we're waiting for something to finish. | ||
1759 | * >0 an error occurred while handling the message. | ||
1760 | * Side effects: | ||
1761 | * | ||
1762 | * Call context: | ||
1763 | * process thread (usually) | ||
1764 | ----------------------------------------------------------------*/ | ||
1765 | int prism2mgmt_auxport_state(wlandevice_t *wlandev, void *msgp) | ||
1766 | { | ||
1767 | p80211msg_p2req_auxport_state_t *msg = msgp; | ||
1768 | |||
1769 | #if (WLAN_HOSTIF != WLAN_USB) | ||
1770 | hfa384x_t *hw = wlandev->priv; | ||
1771 | DBFENTER; | ||
1772 | |||
1773 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1774 | if (msg->enable.data == P80211ENUM_truth_true) { | ||
1775 | if ( hfa384x_cmd_aux_enable(hw, 0) ) { | ||
1776 | msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; | ||
1777 | } else { | ||
1778 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1779 | } | ||
1780 | } else { | ||
1781 | hfa384x_cmd_aux_disable(hw); | ||
1782 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1783 | } | ||
1784 | |||
1785 | #else /* !USB */ | ||
1786 | DBFENTER; | ||
1787 | |||
1788 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1789 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1790 | |||
1791 | #endif /* WLAN_HOSTIF != WLAN_USB */ | ||
1792 | |||
1793 | DBFEXIT; | ||
1794 | return 0; | ||
1795 | } | ||
1796 | |||
1797 | |||
1798 | /*---------------------------------------------------------------- | ||
1799 | * prism2mgmt_auxport_read | ||
1800 | * | ||
1801 | * Copies data from the card using the auxport. The auxport must | ||
1802 | * have previously been enabled. Note: this is not the way to | ||
1803 | * do downloads, see the [ram|flash]dl functions. | ||
1804 | * | ||
1805 | * Arguments: | ||
1806 | * wlandev wlan device structure | ||
1807 | * msgp ptr to msg buffer | ||
1808 | * | ||
1809 | * Returns: | ||
1810 | * 0 success and done | ||
1811 | * <0 success, but we're waiting for something to finish. | ||
1812 | * >0 an error occurred while handling the message. | ||
1813 | * Side effects: | ||
1814 | * | ||
1815 | * Call context: | ||
1816 | * process thread (usually) | ||
1817 | ----------------------------------------------------------------*/ | ||
1818 | int prism2mgmt_auxport_read(wlandevice_t *wlandev, void *msgp) | ||
1819 | { | ||
1820 | #if (WLAN_HOSTIF != WLAN_USB) | ||
1821 | hfa384x_t *hw = wlandev->priv; | ||
1822 | p80211msg_p2req_auxport_read_t *msg = msgp; | ||
1823 | UINT32 addr; | ||
1824 | UINT32 len; | ||
1825 | UINT8* buf; | ||
1826 | UINT32 maxlen = sizeof(msg->data.data); | ||
1827 | DBFENTER; | ||
1828 | |||
1829 | if ( hw->auxen ) { | ||
1830 | addr = msg->addr.data; | ||
1831 | len = msg->len.data; | ||
1832 | buf = msg->data.data; | ||
1833 | if ( len <= maxlen ) { /* max read/write size */ | ||
1834 | hfa384x_copy_from_aux(hw, addr, HFA384x_AUX_CTL_EXTDS, buf, len); | ||
1835 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1836 | } else { | ||
1837 | WLAN_LOG_DEBUG(1,"Attempt to read > maxlen from auxport.\n"); | ||
1838 | msg->resultcode.data = P80211ENUM_resultcode_refused; | ||
1839 | } | ||
1840 | |||
1841 | } else { | ||
1842 | msg->resultcode.data = P80211ENUM_resultcode_refused; | ||
1843 | } | ||
1844 | msg->data.status = P80211ENUM_msgitem_status_data_ok; | ||
1845 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1846 | |||
1847 | DBFEXIT; | ||
1848 | return 0; | ||
1849 | #else | ||
1850 | DBFENTER; | ||
1851 | |||
1852 | WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); | ||
1853 | |||
1854 | DBFEXIT; | ||
1855 | return 0; | ||
1856 | #endif | ||
1857 | } | ||
1858 | |||
1859 | |||
1860 | /*---------------------------------------------------------------- | ||
1861 | * prism2mgmt_auxport_write | ||
1862 | * | ||
1863 | * Copies data to the card using the auxport. The auxport must | ||
1864 | * have previously been enabled. Note: this is not the way to | ||
1865 | * do downloads, see the [ram|flash]dl functions. | ||
1866 | * | ||
1867 | * Arguments: | ||
1868 | * wlandev wlan device structure | ||
1869 | * msgp ptr to msg buffer | ||
1870 | * | ||
1871 | * Returns: | ||
1872 | * 0 success and done | ||
1873 | * <0 success, but we're waiting for something to finish. | ||
1874 | * >0 an error occurred while handling the message. | ||
1875 | * Side effects: | ||
1876 | * | ||
1877 | * Call context: | ||
1878 | * process thread (usually) | ||
1879 | ----------------------------------------------------------------*/ | ||
1880 | int prism2mgmt_auxport_write(wlandevice_t *wlandev, void *msgp) | ||
1881 | { | ||
1882 | #if (WLAN_HOSTIF != WLAN_USB) | ||
1883 | hfa384x_t *hw = wlandev->priv; | ||
1884 | p80211msg_p2req_auxport_write_t *msg = msgp; | ||
1885 | UINT32 addr; | ||
1886 | UINT32 len; | ||
1887 | UINT8* buf; | ||
1888 | UINT32 maxlen = sizeof(msg->data.data); | ||
1889 | DBFENTER; | ||
1890 | |||
1891 | if ( hw->auxen ) { | ||
1892 | addr = msg->addr.data; | ||
1893 | len = msg->len.data; | ||
1894 | buf = msg->data.data; | ||
1895 | if ( len <= maxlen ) { /* max read/write size */ | ||
1896 | hfa384x_copy_to_aux(hw, addr, HFA384x_AUX_CTL_EXTDS, buf, len); | ||
1897 | } else { | ||
1898 | WLAN_LOG_DEBUG(1,"Attempt to write > maxlen from auxport.\n"); | ||
1899 | msg->resultcode.data = P80211ENUM_resultcode_refused; | ||
1900 | } | ||
1901 | |||
1902 | } else { | ||
1903 | msg->resultcode.data = P80211ENUM_resultcode_refused; | ||
1904 | } | ||
1905 | msg->data.status = P80211ENUM_msgitem_status_data_ok; | ||
1906 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1907 | |||
1908 | DBFEXIT; | ||
1909 | return 0; | ||
1910 | #else | ||
1911 | DBFENTER; | ||
1912 | WLAN_LOG_ERROR("prism2mgmt_auxport_read: Not supported on USB.\n"); | ||
1913 | DBFEXIT; | ||
1914 | return 0; | ||
1915 | #endif | ||
1916 | } | ||
1917 | |||
1918 | /*---------------------------------------------------------------- | ||
1919 | * prism2mgmt_low_level | ||
1920 | * | ||
1921 | * Puts the card into the desired test mode. | ||
1922 | * | ||
1923 | * Arguments: | ||
1924 | * wlandev wlan device structure | ||
1925 | * msgp ptr to msg buffer | ||
1926 | * | ||
1927 | * Returns: | ||
1928 | * 0 success and done | ||
1929 | * <0 success, but we're waiting for something to finish. | ||
1930 | * >0 an error occurred while handling the message. | ||
1931 | * Side effects: | ||
1932 | * | ||
1933 | * Call context: | ||
1934 | * process thread (usually) | ||
1935 | ----------------------------------------------------------------*/ | ||
1936 | int prism2mgmt_low_level(wlandevice_t *wlandev, void *msgp) | ||
1937 | { | ||
1938 | hfa384x_t *hw = wlandev->priv; | ||
1939 | p80211msg_p2req_low_level_t *msg = msgp; | ||
1940 | hfa384x_metacmd_t cmd; | ||
1941 | DBFENTER; | ||
1942 | |||
1943 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1944 | |||
1945 | /* call some routine to execute the test command */ | ||
1946 | cmd.cmd = (UINT16) msg->command.data; | ||
1947 | cmd.parm0 = (UINT16) msg->param0.data; | ||
1948 | cmd.parm1 = (UINT16) msg->param1.data; | ||
1949 | cmd.parm2 = (UINT16) msg->param2.data; | ||
1950 | |||
1951 | hfa384x_drvr_low_level(hw,&cmd); | ||
1952 | |||
1953 | msg->resp0.data = (UINT32) cmd.result.resp0; | ||
1954 | msg->resp1.data = (UINT32) cmd.result.resp1; | ||
1955 | msg->resp2.data = (UINT32) cmd.result.resp2; | ||
1956 | |||
1957 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1958 | |||
1959 | DBFEXIT; | ||
1960 | return 0; | ||
1961 | } | ||
1962 | |||
1963 | /*---------------------------------------------------------------- | ||
1964 | * prism2mgmt_test_command | ||
1965 | * | ||
1966 | * Puts the card into the desired test mode. | ||
1967 | * | ||
1968 | * Arguments: | ||
1969 | * wlandev wlan device structure | ||
1970 | * msgp ptr to msg buffer | ||
1971 | * | ||
1972 | * Returns: | ||
1973 | * 0 success and done | ||
1974 | * <0 success, but we're waiting for something to finish. | ||
1975 | * >0 an error occurred while handling the message. | ||
1976 | * Side effects: | ||
1977 | * | ||
1978 | * Call context: | ||
1979 | * process thread (usually) | ||
1980 | ----------------------------------------------------------------*/ | ||
1981 | int prism2mgmt_test_command(wlandevice_t *wlandev, void *msgp) | ||
1982 | { | ||
1983 | hfa384x_t *hw = wlandev->priv; | ||
1984 | p80211msg_p2req_test_command_t *msg = msgp; | ||
1985 | hfa384x_metacmd_t cmd; | ||
1986 | |||
1987 | DBFENTER; | ||
1988 | |||
1989 | cmd.cmd = ((UINT16) msg->testcode.data) << 8 | 0x38; | ||
1990 | cmd.parm0 = (UINT16) msg->testparam.data; | ||
1991 | cmd.parm1 = 0; | ||
1992 | cmd.parm2 = 0; | ||
1993 | |||
1994 | /* call some routine to execute the test command */ | ||
1995 | |||
1996 | hfa384x_drvr_low_level(hw,&cmd); | ||
1997 | |||
1998 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1999 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2000 | |||
2001 | msg->status.status = P80211ENUM_msgitem_status_data_ok; | ||
2002 | msg->status.data = cmd.result.status; | ||
2003 | msg->resp0.status = P80211ENUM_msgitem_status_data_ok; | ||
2004 | msg->resp0.data = cmd.result.resp0; | ||
2005 | msg->resp1.status = P80211ENUM_msgitem_status_data_ok; | ||
2006 | msg->resp1.data = cmd.result.resp1; | ||
2007 | msg->resp2.status = P80211ENUM_msgitem_status_data_ok; | ||
2008 | msg->resp2.data = cmd.result.resp2; | ||
2009 | |||
2010 | DBFEXIT; | ||
2011 | return 0; | ||
2012 | } | ||
2013 | |||
2014 | |||
2015 | /*---------------------------------------------------------------- | ||
2016 | * prism2mgmt_mmi_read | ||
2017 | * | ||
2018 | * Read from one of the MMI registers. | ||
2019 | * | ||
2020 | * Arguments: | ||
2021 | * wlandev wlan device structure | ||
2022 | * msgp ptr to msg buffer | ||
2023 | * | ||
2024 | * Returns: | ||
2025 | * 0 success and done | ||
2026 | * <0 success, but we're waiting for something to finish. | ||
2027 | * >0 an error occurred while handling the message. | ||
2028 | * Side effects: | ||
2029 | * | ||
2030 | * Call context: | ||
2031 | * process thread (usually) | ||
2032 | ----------------------------------------------------------------*/ | ||
2033 | int prism2mgmt_mmi_read(wlandevice_t *wlandev, void *msgp) | ||
2034 | { | ||
2035 | hfa384x_t *hw = wlandev->priv; | ||
2036 | p80211msg_p2req_mmi_read_t *msg = msgp; | ||
2037 | UINT32 resp = 0; | ||
2038 | |||
2039 | DBFENTER; | ||
2040 | |||
2041 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2042 | |||
2043 | /* call some routine to execute the test command */ | ||
2044 | |||
2045 | hfa384x_drvr_mmi_read(hw, msg->addr.data, &resp); | ||
2046 | |||
2047 | /* I'm not sure if this is "architecturally" correct, but it | ||
2048 | is expedient. */ | ||
2049 | |||
2050 | msg->value.status = P80211ENUM_msgitem_status_data_ok; | ||
2051 | msg->value.data = resp; | ||
2052 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2053 | |||
2054 | DBFEXIT; | ||
2055 | return 0; | ||
2056 | } | ||
2057 | |||
2058 | /*---------------------------------------------------------------- | ||
2059 | * prism2mgmt_mmi_write | ||
2060 | * | ||
2061 | * Write a data value to one of the MMI registers. | ||
2062 | * | ||
2063 | * Arguments: | ||
2064 | * wlandev wlan device structure | ||
2065 | * msgp ptr to msg buffer | ||
2066 | * | ||
2067 | * Returns: | ||
2068 | * 0 success and done | ||
2069 | * <0 success, but we're waiting for something to finish. | ||
2070 | * >0 an error occurred while handling the message. | ||
2071 | * Side effects: | ||
2072 | * | ||
2073 | * Call context: | ||
2074 | * process thread (usually) | ||
2075 | ----------------------------------------------------------------*/ | ||
2076 | int prism2mgmt_mmi_write(wlandevice_t *wlandev, void *msgp) | ||
2077 | { | ||
2078 | hfa384x_t *hw = wlandev->priv; | ||
2079 | p80211msg_p2req_mmi_write_t *msg = msgp; | ||
2080 | DBFENTER; | ||
2081 | |||
2082 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2083 | |||
2084 | /* call some routine to execute the test command */ | ||
2085 | |||
2086 | hfa384x_drvr_mmi_write(hw, msg->addr.data, msg->data.data); | ||
2087 | |||
2088 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2089 | |||
2090 | DBFEXIT; | ||
2091 | return 0; | ||
2092 | } | ||
2093 | |||
2094 | /*---------------------------------------------------------------- | ||
2095 | * prism2mgmt_ramdl_state | ||
2096 | * | ||
2097 | * Establishes the beginning/end of a card RAM download session. | ||
2098 | * | ||
2099 | * It is expected that the ramdl_write() function will be called | ||
2100 | * one or more times between the 'enable' and 'disable' calls to | ||
2101 | * this function. | ||
2102 | * | ||
2103 | * Note: This function should not be called when a mac comm port | ||
2104 | * is active. | ||
2105 | * | ||
2106 | * Arguments: | ||
2107 | * wlandev wlan device structure | ||
2108 | * msgp ptr to msg buffer | ||
2109 | * | ||
2110 | * Returns: | ||
2111 | * 0 success and done | ||
2112 | * <0 success, but we're waiting for something to finish. | ||
2113 | * >0 an error occurred while handling the message. | ||
2114 | * Side effects: | ||
2115 | * | ||
2116 | * Call context: | ||
2117 | * process thread (usually) | ||
2118 | ----------------------------------------------------------------*/ | ||
2119 | int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp) | ||
2120 | { | ||
2121 | hfa384x_t *hw = wlandev->priv; | ||
2122 | p80211msg_p2req_ramdl_state_t *msg = msgp; | ||
2123 | DBFENTER; | ||
2124 | |||
2125 | if (wlandev->msdstate != WLAN_MSD_FWLOAD) { | ||
2126 | WLAN_LOG_ERROR( | ||
2127 | "ramdl_state(): may only be called " | ||
2128 | "in the fwload state.\n"); | ||
2129 | msg->resultcode.data = | ||
2130 | P80211ENUM_resultcode_implementation_failure; | ||
2131 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2132 | DBFEXIT; | ||
2133 | return 0; | ||
2134 | } | ||
2135 | |||
2136 | /* | ||
2137 | ** Note: Interrupts are locked out if this is an AP and are NOT | ||
2138 | ** locked out if this is a station. | ||
2139 | */ | ||
2140 | |||
2141 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2142 | if ( msg->enable.data == P80211ENUM_truth_true ) { | ||
2143 | if ( hfa384x_drvr_ramdl_enable(hw, msg->exeaddr.data) ) { | ||
2144 | msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; | ||
2145 | } else { | ||
2146 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2147 | } | ||
2148 | } else { | ||
2149 | hfa384x_drvr_ramdl_disable(hw); | ||
2150 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2151 | } | ||
2152 | |||
2153 | DBFEXIT; | ||
2154 | return 0; | ||
2155 | } | ||
2156 | |||
2157 | |||
2158 | /*---------------------------------------------------------------- | ||
2159 | * prism2mgmt_ramdl_write | ||
2160 | * | ||
2161 | * Writes a buffer to the card RAM using the download state. This | ||
2162 | * is for writing code to card RAM. To just read or write raw data | ||
2163 | * use the aux functions. | ||
2164 | * | ||
2165 | * Arguments: | ||
2166 | * wlandev wlan device structure | ||
2167 | * msgp ptr to msg buffer | ||
2168 | * | ||
2169 | * Returns: | ||
2170 | * 0 success and done | ||
2171 | * <0 success, but we're waiting for something to finish. | ||
2172 | * >0 an error occurred while handling the message. | ||
2173 | * Side effects: | ||
2174 | * | ||
2175 | * Call context: | ||
2176 | * process thread (usually) | ||
2177 | ----------------------------------------------------------------*/ | ||
2178 | int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp) | ||
2179 | { | ||
2180 | hfa384x_t *hw = wlandev->priv; | ||
2181 | p80211msg_p2req_ramdl_write_t *msg = msgp; | ||
2182 | UINT32 addr; | ||
2183 | UINT32 len; | ||
2184 | UINT8 *buf; | ||
2185 | DBFENTER; | ||
2186 | |||
2187 | if (wlandev->msdstate != WLAN_MSD_FWLOAD) { | ||
2188 | WLAN_LOG_ERROR( | ||
2189 | "ramdl_write(): may only be called " | ||
2190 | "in the fwload state.\n"); | ||
2191 | msg->resultcode.data = | ||
2192 | P80211ENUM_resultcode_implementation_failure; | ||
2193 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2194 | DBFEXIT; | ||
2195 | return 0; | ||
2196 | } | ||
2197 | |||
2198 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2199 | /* first validate the length */ | ||
2200 | if ( msg->len.data > sizeof(msg->data.data) ) { | ||
2201 | msg->resultcode.status = P80211ENUM_resultcode_invalid_parameters; | ||
2202 | return 0; | ||
2203 | } | ||
2204 | /* call the hfa384x function to do the write */ | ||
2205 | addr = msg->addr.data; | ||
2206 | len = msg->len.data; | ||
2207 | buf = msg->data.data; | ||
2208 | if ( hfa384x_drvr_ramdl_write(hw, addr, buf, len) ) { | ||
2209 | msg->resultcode.data = P80211ENUM_resultcode_refused; | ||
2210 | |||
2211 | } | ||
2212 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2213 | |||
2214 | DBFEXIT; | ||
2215 | return 0; | ||
2216 | } | ||
2217 | |||
2218 | |||
2219 | /*---------------------------------------------------------------- | ||
2220 | * prism2mgmt_flashdl_state | ||
2221 | * | ||
2222 | * Establishes the beginning/end of a card Flash download session. | ||
2223 | * | ||
2224 | * It is expected that the flashdl_write() function will be called | ||
2225 | * one or more times between the 'enable' and 'disable' calls to | ||
2226 | * this function. | ||
2227 | * | ||
2228 | * Note: This function should not be called when a mac comm port | ||
2229 | * is active. | ||
2230 | * | ||
2231 | * Arguments: | ||
2232 | * wlandev wlan device structure | ||
2233 | * msgp ptr to msg buffer | ||
2234 | * | ||
2235 | * Returns: | ||
2236 | * 0 success and done | ||
2237 | * <0 success, but we're waiting for something to finish. | ||
2238 | * >0 an error occurred while handling the message. | ||
2239 | * Side effects: | ||
2240 | * | ||
2241 | * Call context: | ||
2242 | * process thread (usually) | ||
2243 | ----------------------------------------------------------------*/ | ||
2244 | int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) | ||
2245 | { | ||
2246 | int result = 0; | ||
2247 | hfa384x_t *hw = wlandev->priv; | ||
2248 | p80211msg_p2req_flashdl_state_t *msg = msgp; | ||
2249 | DBFENTER; | ||
2250 | |||
2251 | if (wlandev->msdstate != WLAN_MSD_FWLOAD) { | ||
2252 | WLAN_LOG_ERROR( | ||
2253 | "flashdl_state(): may only be called " | ||
2254 | "in the fwload state.\n"); | ||
2255 | msg->resultcode.data = | ||
2256 | P80211ENUM_resultcode_implementation_failure; | ||
2257 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2258 | DBFEXIT; | ||
2259 | return 0; | ||
2260 | } | ||
2261 | |||
2262 | /* | ||
2263 | ** Note: Interrupts are locked out if this is an AP and are NOT | ||
2264 | ** locked out if this is a station. | ||
2265 | */ | ||
2266 | |||
2267 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2268 | if ( msg->enable.data == P80211ENUM_truth_true ) { | ||
2269 | if ( hfa384x_drvr_flashdl_enable(hw) ) { | ||
2270 | msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; | ||
2271 | } else { | ||
2272 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2273 | } | ||
2274 | } else { | ||
2275 | hfa384x_drvr_flashdl_disable(hw); | ||
2276 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2277 | /* NOTE: At this point, the MAC is in the post-reset | ||
2278 | * state and the driver is in the fwload state. | ||
2279 | * We need to get the MAC back into the fwload | ||
2280 | * state. To do this, we set the nsdstate to HWPRESENT | ||
2281 | * and then call the ifstate function to redo everything | ||
2282 | * that got us into the fwload state. | ||
2283 | */ | ||
2284 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
2285 | result = prism2sta_ifstate(wlandev, P80211ENUM_ifstate_fwload); | ||
2286 | if (result != P80211ENUM_resultcode_success) { | ||
2287 | WLAN_LOG_ERROR("prism2sta_ifstate(fwload) failed," | ||
2288 | "P80211ENUM_resultcode=%d\n", result); | ||
2289 | msg->resultcode.data = | ||
2290 | P80211ENUM_resultcode_implementation_failure; | ||
2291 | result = -1; | ||
2292 | } | ||
2293 | } | ||
2294 | |||
2295 | DBFEXIT; | ||
2296 | return 0; | ||
2297 | } | ||
2298 | |||
2299 | |||
2300 | /*---------------------------------------------------------------- | ||
2301 | * prism2mgmt_flashdl_write | ||
2302 | * | ||
2303 | * | ||
2304 | * | ||
2305 | * Arguments: | ||
2306 | * wlandev wlan device structure | ||
2307 | * msgp ptr to msg buffer | ||
2308 | * | ||
2309 | * Returns: | ||
2310 | * 0 success and done | ||
2311 | * <0 success, but we're waiting for something to finish. | ||
2312 | * >0 an error occurred while handling the message. | ||
2313 | * Side effects: | ||
2314 | * | ||
2315 | * Call context: | ||
2316 | * process thread (usually) | ||
2317 | ----------------------------------------------------------------*/ | ||
2318 | int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp) | ||
2319 | { | ||
2320 | hfa384x_t *hw = wlandev->priv; | ||
2321 | p80211msg_p2req_flashdl_write_t *msg = msgp; | ||
2322 | UINT32 addr; | ||
2323 | UINT32 len; | ||
2324 | UINT8 *buf; | ||
2325 | DBFENTER; | ||
2326 | |||
2327 | if (wlandev->msdstate != WLAN_MSD_FWLOAD) { | ||
2328 | WLAN_LOG_ERROR( | ||
2329 | "flashdl_write(): may only be called " | ||
2330 | "in the fwload state.\n"); | ||
2331 | msg->resultcode.data = | ||
2332 | P80211ENUM_resultcode_implementation_failure; | ||
2333 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2334 | DBFEXIT; | ||
2335 | return 0; | ||
2336 | } | ||
2337 | |||
2338 | /* | ||
2339 | ** Note: Interrupts are locked out if this is an AP and are NOT | ||
2340 | ** locked out if this is a station. | ||
2341 | */ | ||
2342 | |||
2343 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2344 | /* first validate the length */ | ||
2345 | if ( msg->len.data > sizeof(msg->data.data) ) { | ||
2346 | msg->resultcode.status = | ||
2347 | P80211ENUM_resultcode_invalid_parameters; | ||
2348 | return 0; | ||
2349 | } | ||
2350 | /* call the hfa384x function to do the write */ | ||
2351 | addr = msg->addr.data; | ||
2352 | len = msg->len.data; | ||
2353 | buf = msg->data.data; | ||
2354 | if ( hfa384x_drvr_flashdl_write(hw, addr, buf, len) ) { | ||
2355 | msg->resultcode.data = P80211ENUM_resultcode_refused; | ||
2356 | |||
2357 | } | ||
2358 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2359 | |||
2360 | DBFEXIT; | ||
2361 | return 0; | ||
2362 | } | ||
2363 | |||
2364 | |||
2365 | /*---------------------------------------------------------------- | ||
2366 | * prism2mgmt_dump_state | ||
2367 | * | ||
2368 | * Dumps the driver's and hardware's current state via the kernel | ||
2369 | * log at KERN_NOTICE level. | ||
2370 | * | ||
2371 | * Arguments: | ||
2372 | * wlandev wlan device structure | ||
2373 | * msgp ptr to msg buffer | ||
2374 | * | ||
2375 | * Returns: | ||
2376 | * 0 success and done | ||
2377 | * <0 success, but we're waiting for something to finish. | ||
2378 | * >0 an error occurred while handling the message. | ||
2379 | * Side effects: | ||
2380 | * | ||
2381 | * Call context: | ||
2382 | * process thread (usually) | ||
2383 | ----------------------------------------------------------------*/ | ||
2384 | int prism2mgmt_dump_state(wlandevice_t *wlandev, void *msgp) | ||
2385 | { | ||
2386 | p80211msg_p2req_dump_state_t *msg = msgp; | ||
2387 | int result = 0; | ||
2388 | |||
2389 | #if (WLAN_HOSTIF != WLAN_USB) | ||
2390 | hfa384x_t *hw = wlandev->priv; | ||
2391 | UINT16 auxbuf[15]; | ||
2392 | DBFENTER; | ||
2393 | |||
2394 | WLAN_LOG_NOTICE("prism2 driver and hardware state:\n"); | ||
2395 | if ( (result = hfa384x_cmd_aux_enable(hw, 0)) ) { | ||
2396 | WLAN_LOG_ERROR("aux_enable failed, result=%d\n", result); | ||
2397 | goto failed; | ||
2398 | } | ||
2399 | hfa384x_copy_from_aux(hw, | ||
2400 | 0x01e2, | ||
2401 | HFA384x_AUX_CTL_EXTDS, | ||
2402 | auxbuf, | ||
2403 | sizeof(auxbuf)); | ||
2404 | hfa384x_cmd_aux_disable(hw); | ||
2405 | WLAN_LOG_NOTICE(" cmac: FreeBlocks=%d\n", auxbuf[5]); | ||
2406 | WLAN_LOG_NOTICE(" cmac: IntEn=0x%02x EvStat=0x%02x\n", | ||
2407 | hfa384x_getreg(hw, HFA384x_INTEN), | ||
2408 | hfa384x_getreg(hw, HFA384x_EVSTAT)); | ||
2409 | |||
2410 | #ifdef USE_FID_STACK | ||
2411 | WLAN_LOG_NOTICE(" drvr: txfid_top=%d stacksize=%d\n", | ||
2412 | hw->txfid_top,HFA384x_DRVR_FIDSTACKLEN_MAX); | ||
2413 | #else | ||
2414 | WLAN_LOG_NOTICE(" drvr: txfid_head=%d txfid_tail=%d txfid_N=%d\n", | ||
2415 | hw->txfid_head, hw->txfid_tail, hw->txfid_N); | ||
2416 | #endif | ||
2417 | |||
2418 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2419 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2420 | |||
2421 | #else /* (WLAN_HOSTIF == WLAN_USB) */ | ||
2422 | |||
2423 | DBFENTER; | ||
2424 | |||
2425 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2426 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2427 | goto failed; | ||
2428 | |||
2429 | #endif /* (WLAN_HOSTIF != WLAN_USB) */ | ||
2430 | |||
2431 | failed: | ||
2432 | DBFEXIT; | ||
2433 | return result; | ||
2434 | } | ||
2435 | |||
2436 | /*---------------------------------------------------------------- | ||
2437 | * prism2mgmt_channel_info | ||
2438 | * | ||
2439 | * Issues a ChannelInfoRequest. | ||
2440 | * | ||
2441 | * Arguments: | ||
2442 | * wlandev wlan device structure | ||
2443 | * msgp ptr to msg buffer | ||
2444 | * | ||
2445 | * Returns: | ||
2446 | * 0 success and done | ||
2447 | * <0 success, but we're waiting for something to finish. | ||
2448 | * >0 an error occurred while handling the message. | ||
2449 | * Side effects: | ||
2450 | * | ||
2451 | * Call context: | ||
2452 | * process thread (usually) | ||
2453 | ----------------------------------------------------------------*/ | ||
2454 | int prism2mgmt_channel_info(wlandevice_t *wlandev, void *msgp) | ||
2455 | { | ||
2456 | p80211msg_p2req_channel_info_t *msg=msgp; | ||
2457 | hfa384x_t *hw = wlandev->priv; | ||
2458 | int result, i, n=0; | ||
2459 | UINT16 channel_mask=0; | ||
2460 | hfa384x_ChannelInfoRequest_data_t chinforeq; | ||
2461 | // unsigned long now; | ||
2462 | |||
2463 | DBFENTER; | ||
2464 | |||
2465 | if (!hw->ap) { | ||
2466 | |||
2467 | /*** STATION ***/ | ||
2468 | |||
2469 | /* Not supported in STA f/w */ | ||
2470 | P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_not_supported); | ||
2471 | goto done; | ||
2472 | } | ||
2473 | |||
2474 | /*** ACCESS POINT ***/ | ||
2475 | |||
2476 | #define CHINFO_TIMEOUT 2 | ||
2477 | |||
2478 | P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_success); | ||
2479 | |||
2480 | /* setting default value for channellist = all channels */ | ||
2481 | if (!msg->channellist.data) { | ||
2482 | P80211_SET_INT(msg->channellist, 0x00007FFE); | ||
2483 | } | ||
2484 | /* setting default value for channeldwelltime = 100 ms */ | ||
2485 | if (!msg->channeldwelltime.data) { | ||
2486 | P80211_SET_INT(msg->channeldwelltime, 100); | ||
2487 | } | ||
2488 | channel_mask = (UINT16) (msg->channellist.data >> 1); | ||
2489 | for (i=0, n=0; i < 14; i++) { | ||
2490 | if (channel_mask & (1<<i)) { | ||
2491 | n++; | ||
2492 | } | ||
2493 | } | ||
2494 | P80211_SET_INT(msg->numchinfo, n); | ||
2495 | chinforeq.channelList = host2hfa384x_16(channel_mask); | ||
2496 | chinforeq.channelDwellTime = host2hfa384x_16(msg->channeldwelltime.data); | ||
2497 | |||
2498 | atomic_set(&hw->channel_info.done, 1); | ||
2499 | |||
2500 | result = hfa384x_drvr_setconfig( hw, HFA384x_RID_CHANNELINFOREQUEST, | ||
2501 | &chinforeq, HFA384x_RID_CHANNELINFOREQUEST_LEN); | ||
2502 | if ( result ) { | ||
2503 | WLAN_LOG_ERROR("setconfig(CHANNELINFOREQUEST) failed. result=%d\n", | ||
2504 | result); | ||
2505 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2506 | goto done; | ||
2507 | } | ||
2508 | /* | ||
2509 | now = jiffies; | ||
2510 | while (atomic_read(&hw->channel_info.done) != 1) { | ||
2511 | if ((jiffies - now) > CHINFO_TIMEOUT*HZ) { | ||
2512 | WLAN_LOG_NOTICE("ChannelInfo results not received in %d seconds, aborting.\n", | ||
2513 | CHINFO_TIMEOUT); | ||
2514 | msg->resultcode.data = P80211ENUM_resultcode_timeout; | ||
2515 | goto done; | ||
2516 | } | ||
2517 | current->state = TASK_INTERRUPTIBLE; | ||
2518 | schedule_timeout(HZ/4); | ||
2519 | current->state = TASK_RUNNING; | ||
2520 | } | ||
2521 | */ | ||
2522 | |||
2523 | done: | ||
2524 | |||
2525 | DBFEXIT; | ||
2526 | return 0; | ||
2527 | } | ||
2528 | |||
2529 | /*---------------------------------------------------------------- | ||
2530 | * prism2mgmt_channel_info_results | ||
2531 | * | ||
2532 | * Returns required ChannelInfo result. | ||
2533 | * | ||
2534 | * Arguments: | ||
2535 | * wlandev wlan device structure | ||
2536 | * msgp ptr to msg buffer | ||
2537 | * | ||
2538 | * Returns: | ||
2539 | * 0 success and done | ||
2540 | * <0 success, but we're waiting for something to finish. | ||
2541 | * >0 an error occurred while handling the message. | ||
2542 | * Side effects: | ||
2543 | * | ||
2544 | * Call context: | ||
2545 | * process thread (usually) | ||
2546 | ----------------------------------------------------------------*/ | ||
2547 | int prism2mgmt_channel_info_results(wlandevice_t *wlandev, void *msgp) | ||
2548 | { | ||
2549 | hfa384x_t *hw = wlandev->priv; | ||
2550 | |||
2551 | p80211msg_p2req_channel_info_results_t *msg=msgp; | ||
2552 | int result=0; | ||
2553 | int channel; | ||
2554 | |||
2555 | DBFENTER; | ||
2556 | |||
2557 | if (!hw->ap) { | ||
2558 | |||
2559 | /*** STATION ***/ | ||
2560 | |||
2561 | /* Not supported in STA f/w */ | ||
2562 | P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_not_supported); | ||
2563 | goto done; | ||
2564 | } | ||
2565 | |||
2566 | /*** ACCESS POINT ***/ | ||
2567 | |||
2568 | switch (atomic_read(&hw->channel_info.done)) { | ||
2569 | case 0: msg->resultcode.status = P80211ENUM_msgitem_status_no_value; | ||
2570 | goto done; | ||
2571 | case 1: msg->resultcode.status = P80211ENUM_msgitem_status_incomplete_itemdata; | ||
2572 | goto done; | ||
2573 | } | ||
2574 | |||
2575 | P80211_SET_INT(msg->resultcode, P80211ENUM_resultcode_success); | ||
2576 | channel=msg->channel.data-1; | ||
2577 | |||
2578 | if (channel < 0 || ! (hw->channel_info.results.scanchannels & 1<<channel) ) { | ||
2579 | msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
2580 | goto done; | ||
2581 | } | ||
2582 | WLAN_LOG_DEBUG(2, "chinfo_results: channel %d, avg/peak level=%d/%d dB, active=%d\n", | ||
2583 | channel+1, | ||
2584 | hw->channel_info.results.result[channel].anl, | ||
2585 | hw->channel_info.results.result[channel].pnl, | ||
2586 | hw->channel_info.results.result[channel].active | ||
2587 | ); | ||
2588 | P80211_SET_INT(msg->avgnoiselevel, hw->channel_info.results.result[channel].anl); | ||
2589 | P80211_SET_INT(msg->peaknoiselevel, hw->channel_info.results.result[channel].pnl); | ||
2590 | P80211_SET_INT(msg->bssactive, hw->channel_info.results.result[channel].active & | ||
2591 | HFA384x_CHINFORESULT_BSSACTIVE | ||
2592 | ? P80211ENUM_truth_true | ||
2593 | : P80211ENUM_truth_false) ; | ||
2594 | P80211_SET_INT(msg->pcfactive, hw->channel_info.results.result[channel].active & | ||
2595 | HFA384x_CHINFORESULT_PCFACTIVE | ||
2596 | ? P80211ENUM_truth_true | ||
2597 | : P80211ENUM_truth_false) ; | ||
2598 | |||
2599 | done: | ||
2600 | DBFEXIT; | ||
2601 | return result; | ||
2602 | } | ||
2603 | |||
2604 | |||
2605 | /*---------------------------------------------------------------- | ||
2606 | * prism2mgmt_autojoin | ||
2607 | * | ||
2608 | * Associate with an ESS. | ||
2609 | * | ||
2610 | * Arguments: | ||
2611 | * wlandev wlan device structure | ||
2612 | * msgp ptr to msg buffer | ||
2613 | * | ||
2614 | * Returns: | ||
2615 | * 0 success and done | ||
2616 | * <0 success, but we're waiting for something to finish. | ||
2617 | * >0 an error occurred while handling the message. | ||
2618 | * Side effects: | ||
2619 | * | ||
2620 | * Call context: | ||
2621 | * process thread (usually) | ||
2622 | * interrupt | ||
2623 | ----------------------------------------------------------------*/ | ||
2624 | int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) | ||
2625 | { | ||
2626 | hfa384x_t *hw = wlandev->priv; | ||
2627 | int result = 0; | ||
2628 | UINT16 reg; | ||
2629 | UINT16 port_type; | ||
2630 | p80211msg_lnxreq_autojoin_t *msg = msgp; | ||
2631 | p80211pstrd_t *pstr; | ||
2632 | UINT8 bytebuf[256]; | ||
2633 | hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*)bytebuf; | ||
2634 | DBFENTER; | ||
2635 | |||
2636 | wlandev->macmode = WLAN_MACMODE_NONE; | ||
2637 | |||
2638 | /* Set the SSID */ | ||
2639 | memcpy(&wlandev->ssid, &msg->ssid.data, sizeof(msg->ssid.data)); | ||
2640 | |||
2641 | if (hw->ap) { | ||
2642 | |||
2643 | /*** ACCESS POINT ***/ | ||
2644 | |||
2645 | /* Never supported on AP */ | ||
2646 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2647 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2648 | goto done; | ||
2649 | } | ||
2650 | |||
2651 | /* Disable the Port */ | ||
2652 | hfa384x_drvr_disable(hw, 0); | ||
2653 | |||
2654 | /*** STATION ***/ | ||
2655 | /* Set the TxRates */ | ||
2656 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, 0x000f); | ||
2657 | |||
2658 | /* Set the auth type */ | ||
2659 | if ( msg->authtype.data == P80211ENUM_authalg_sharedkey ) { | ||
2660 | reg = HFA384x_CNFAUTHENTICATION_SHAREDKEY; | ||
2661 | } else { | ||
2662 | reg = HFA384x_CNFAUTHENTICATION_OPENSYSTEM; | ||
2663 | } | ||
2664 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAUTHENTICATION, reg); | ||
2665 | |||
2666 | /* Set the ssid */ | ||
2667 | memset(bytebuf, 0, 256); | ||
2668 | pstr = (p80211pstrd_t*)&(msg->ssid.data); | ||
2669 | prism2mgmt_pstr2bytestr(p2bytestr, pstr); | ||
2670 | result = hfa384x_drvr_setconfig( | ||
2671 | hw, HFA384x_RID_CNFDESIREDSSID, | ||
2672 | bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); | ||
2673 | #if 0 | ||
2674 | /* we can use the new-fangled auto-unknown mode if the firmware | ||
2675 | is 1.3.3 or newer */ | ||
2676 | if (HFA384x_FIRMARE_VERSION(hw->ident_sta_fw.major, | ||
2677 | hw->ident_sta_fw.minor, | ||
2678 | hw->ident_sta_fw.variant) >= | ||
2679 | HFA384x_FIRMWARE_VERSION(1,3,3)) { | ||
2680 | /* Set up the IBSS options */ | ||
2681 | reg = HFA384x_CREATEIBSS_JOINESS_JOINCREATEIBSS; | ||
2682 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CREATEIBSS, reg); | ||
2683 | |||
2684 | /* Set the PortType */ | ||
2685 | port_type = HFA384x_PORTTYPE_IBSS; | ||
2686 | } else { | ||
2687 | port_type = HFA384x_PORTTYPE_BSS; | ||
2688 | } | ||
2689 | #else | ||
2690 | port_type = HFA384x_PORTTYPE_BSS; | ||
2691 | #endif | ||
2692 | /* Set the PortType */ | ||
2693 | hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPORTTYPE, port_type); | ||
2694 | |||
2695 | /* Enable the Port */ | ||
2696 | hfa384x_drvr_enable(hw, 0); | ||
2697 | |||
2698 | /* Set the resultcode */ | ||
2699 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2700 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2701 | |||
2702 | done: | ||
2703 | DBFEXIT; | ||
2704 | return result; | ||
2705 | } | ||
2706 | |||
2707 | |||
2708 | /*---------------------------------------------------------------- | ||
2709 | * prism2mgmt_wlansniff | ||
2710 | * | ||
2711 | * Start or stop sniffing. | ||
2712 | * | ||
2713 | * Arguments: | ||
2714 | * wlandev wlan device structure | ||
2715 | * msgp ptr to msg buffer | ||
2716 | * | ||
2717 | * Returns: | ||
2718 | * 0 success and done | ||
2719 | * <0 success, but we're waiting for something to finish. | ||
2720 | * >0 an error occurred while handling the message. | ||
2721 | * Side effects: | ||
2722 | * | ||
2723 | * Call context: | ||
2724 | * process thread (usually) | ||
2725 | * interrupt | ||
2726 | ----------------------------------------------------------------*/ | ||
2727 | int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) | ||
2728 | { | ||
2729 | int result = 0; | ||
2730 | p80211msg_lnxreq_wlansniff_t *msg = msgp; | ||
2731 | |||
2732 | hfa384x_t *hw = wlandev->priv; | ||
2733 | UINT16 word; | ||
2734 | |||
2735 | DBFENTER; | ||
2736 | |||
2737 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
2738 | switch (msg->enable.data) | ||
2739 | { | ||
2740 | case P80211ENUM_truth_false: | ||
2741 | /* Confirm that we're in monitor mode */ | ||
2742 | if ( wlandev->netdev->type == ARPHRD_ETHER ) { | ||
2743 | msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
2744 | result = 0; | ||
2745 | goto exit; | ||
2746 | } | ||
2747 | /* Disable monitor mode */ | ||
2748 | result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE); | ||
2749 | if ( result ) { | ||
2750 | WLAN_LOG_DEBUG(1, | ||
2751 | "failed to disable monitor mode, result=%d\n", | ||
2752 | result); | ||
2753 | goto failed; | ||
2754 | } | ||
2755 | /* Disable port 0 */ | ||
2756 | result = hfa384x_drvr_disable(hw, 0); | ||
2757 | if ( result ) { | ||
2758 | WLAN_LOG_DEBUG(1, | ||
2759 | "failed to disable port 0 after sniffing, result=%d\n", | ||
2760 | result); | ||
2761 | goto failed; | ||
2762 | } | ||
2763 | /* Clear the driver state */ | ||
2764 | wlandev->netdev->type = ARPHRD_ETHER; | ||
2765 | |||
2766 | /* Restore the wepflags */ | ||
2767 | result = hfa384x_drvr_setconfig16(hw, | ||
2768 | HFA384x_RID_CNFWEPFLAGS, | ||
2769 | hw->presniff_wepflags); | ||
2770 | if ( result ) { | ||
2771 | WLAN_LOG_DEBUG(1, | ||
2772 | "failed to restore wepflags=0x%04x, result=%d\n", | ||
2773 | hw->presniff_wepflags, | ||
2774 | result); | ||
2775 | goto failed; | ||
2776 | } | ||
2777 | |||
2778 | /* Set the port to its prior type and enable (if necessary) */ | ||
2779 | if (hw->presniff_port_type != 0 ) { | ||
2780 | word = hw->presniff_port_type; | ||
2781 | result = hfa384x_drvr_setconfig16(hw, | ||
2782 | HFA384x_RID_CNFPORTTYPE, word); | ||
2783 | if ( result ) { | ||
2784 | WLAN_LOG_DEBUG(1, | ||
2785 | "failed to restore porttype, result=%d\n", | ||
2786 | result); | ||
2787 | goto failed; | ||
2788 | } | ||
2789 | |||
2790 | /* Enable the port */ | ||
2791 | result = hfa384x_drvr_enable(hw, 0); | ||
2792 | if ( result ) { | ||
2793 | WLAN_LOG_DEBUG(1, "failed to enable port to presniff setting, result=%d\n", result); | ||
2794 | goto failed; | ||
2795 | } | ||
2796 | } else { | ||
2797 | result = hfa384x_drvr_disable(hw, 0); | ||
2798 | |||
2799 | } | ||
2800 | |||
2801 | WLAN_LOG_INFO("monitor mode disabled\n"); | ||
2802 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2803 | result = 0; | ||
2804 | goto exit; | ||
2805 | break; | ||
2806 | case P80211ENUM_truth_true: | ||
2807 | /* Disable the port (if enabled), only check Port 0 */ | ||
2808 | if ( hw->port_enabled[0]) { | ||
2809 | if (wlandev->netdev->type == ARPHRD_ETHER) { | ||
2810 | /* Save macport 0 state */ | ||
2811 | result = hfa384x_drvr_getconfig16(hw, | ||
2812 | HFA384x_RID_CNFPORTTYPE, | ||
2813 | &(hw->presniff_port_type)); | ||
2814 | if ( result ) { | ||
2815 | WLAN_LOG_DEBUG(1,"failed to read porttype, result=%d\n", result); | ||
2816 | goto failed; | ||
2817 | } | ||
2818 | /* Save the wepflags state */ | ||
2819 | result = hfa384x_drvr_getconfig16(hw, | ||
2820 | HFA384x_RID_CNFWEPFLAGS, | ||
2821 | &(hw->presniff_wepflags)); | ||
2822 | if ( result ) { | ||
2823 | WLAN_LOG_DEBUG(1,"failed to read wepflags, result=%d\n", result); | ||
2824 | goto failed; | ||
2825 | } | ||
2826 | hfa384x_drvr_stop(hw); | ||
2827 | result = hfa384x_drvr_start(hw); | ||
2828 | if ( result ) { | ||
2829 | WLAN_LOG_DEBUG(1, | ||
2830 | "failed to restart the card for sniffing, result=%d\n", | ||
2831 | result); | ||
2832 | goto failed; | ||
2833 | } | ||
2834 | } else { | ||
2835 | /* Disable the port */ | ||
2836 | result = hfa384x_drvr_disable(hw, 0); | ||
2837 | if ( result ) { | ||
2838 | WLAN_LOG_DEBUG(1, | ||
2839 | "failed to enable port for sniffing, result=%d\n", | ||
2840 | result); | ||
2841 | goto failed; | ||
2842 | } | ||
2843 | } | ||
2844 | } else { | ||
2845 | hw->presniff_port_type = 0; | ||
2846 | } | ||
2847 | |||
2848 | /* Set the channel we wish to sniff */ | ||
2849 | word = msg->channel.data; | ||
2850 | result = hfa384x_drvr_setconfig16(hw, | ||
2851 | HFA384x_RID_CNFOWNCHANNEL, word); | ||
2852 | hw->sniff_channel=word; | ||
2853 | |||
2854 | if ( result ) { | ||
2855 | WLAN_LOG_DEBUG(1, | ||
2856 | "failed to set channel %d, result=%d\n", | ||
2857 | word, | ||
2858 | result); | ||
2859 | goto failed; | ||
2860 | } | ||
2861 | |||
2862 | /* Now if we're already sniffing, we can skip the rest */ | ||
2863 | if (wlandev->netdev->type != ARPHRD_ETHER) { | ||
2864 | /* Set the port type to pIbss */ | ||
2865 | word = HFA384x_PORTTYPE_PSUEDOIBSS; | ||
2866 | result = hfa384x_drvr_setconfig16(hw, | ||
2867 | HFA384x_RID_CNFPORTTYPE, word); | ||
2868 | if ( result ) { | ||
2869 | WLAN_LOG_DEBUG(1, | ||
2870 | "failed to set porttype %d, result=%d\n", | ||
2871 | word, | ||
2872 | result); | ||
2873 | goto failed; | ||
2874 | } | ||
2875 | if ((msg->keepwepflags.status == P80211ENUM_msgitem_status_data_ok) && (msg->keepwepflags.data != P80211ENUM_truth_true)) { | ||
2876 | /* Set the wepflags for no decryption */ | ||
2877 | word = HFA384x_WEPFLAGS_DISABLE_TXCRYPT | | ||
2878 | HFA384x_WEPFLAGS_DISABLE_RXCRYPT; | ||
2879 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFWEPFLAGS, word); | ||
2880 | } | ||
2881 | |||
2882 | if ( result ) { | ||
2883 | WLAN_LOG_DEBUG(1, | ||
2884 | "failed to set wepflags=0x%04x, result=%d\n", | ||
2885 | word, | ||
2886 | result); | ||
2887 | goto failed; | ||
2888 | } | ||
2889 | } | ||
2890 | |||
2891 | /* Do we want to strip the FCS in monitor mode? */ | ||
2892 | if ((msg->stripfcs.status == P80211ENUM_msgitem_status_data_ok) && (msg->stripfcs.data == P80211ENUM_truth_true)) { | ||
2893 | hw->sniff_fcs = 0; | ||
2894 | } else { | ||
2895 | hw->sniff_fcs = 1; | ||
2896 | } | ||
2897 | |||
2898 | /* Do we want to truncate the packets? */ | ||
2899 | if (msg->packet_trunc.status == P80211ENUM_msgitem_status_data_ok) { | ||
2900 | hw->sniff_truncate = msg->packet_trunc.data; | ||
2901 | } else { | ||
2902 | hw->sniff_truncate = 0; | ||
2903 | } | ||
2904 | |||
2905 | /* Enable the port */ | ||
2906 | result = hfa384x_drvr_enable(hw, 0); | ||
2907 | if ( result ) { | ||
2908 | WLAN_LOG_DEBUG(1, | ||
2909 | "failed to enable port for sniffing, result=%d\n", | ||
2910 | result); | ||
2911 | goto failed; | ||
2912 | } | ||
2913 | /* Enable monitor mode */ | ||
2914 | result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_ENABLE); | ||
2915 | if ( result ) { | ||
2916 | WLAN_LOG_DEBUG(1, | ||
2917 | "failed to enable monitor mode, result=%d\n", | ||
2918 | result); | ||
2919 | goto failed; | ||
2920 | } | ||
2921 | |||
2922 | if (wlandev->netdev->type == ARPHRD_ETHER) { | ||
2923 | WLAN_LOG_INFO("monitor mode enabled\n"); | ||
2924 | } | ||
2925 | |||
2926 | /* Set the driver state */ | ||
2927 | /* Do we want the prism2 header? */ | ||
2928 | if ((msg->prismheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->prismheader.data == P80211ENUM_truth_true)) { | ||
2929 | hw->sniffhdr = 0; | ||
2930 | wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; | ||
2931 | } else if ((msg->wlanheader.status == P80211ENUM_msgitem_status_data_ok) && (msg->wlanheader.data == P80211ENUM_truth_true)) { | ||
2932 | hw->sniffhdr = 1; | ||
2933 | wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; | ||
2934 | } else { | ||
2935 | wlandev->netdev->type = ARPHRD_IEEE80211; | ||
2936 | } | ||
2937 | |||
2938 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2939 | result = 0; | ||
2940 | goto exit; | ||
2941 | break; | ||
2942 | default: | ||
2943 | msg->resultcode.data = P80211ENUM_resultcode_invalid_parameters; | ||
2944 | result = 0; | ||
2945 | goto exit; | ||
2946 | break; | ||
2947 | } | ||
2948 | |||
2949 | failed: | ||
2950 | msg->resultcode.data = P80211ENUM_resultcode_refused; | ||
2951 | result = 0; | ||
2952 | exit: | ||
2953 | |||
2954 | DBFEXIT; | ||
2955 | return result; | ||
2956 | } | ||
diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h new file mode 100644 index 000000000000..733fd999c928 --- /dev/null +++ b/drivers/staging/wlan-ng/prism2mgmt.h | |||
@@ -0,0 +1,182 @@ | |||
1 | /* prism2mgmt.h | ||
2 | * | ||
3 | * Declares the mgmt command handler functions | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file contains the constants and data structures for interaction | ||
48 | * with the hfa384x Wireless LAN (WLAN) Media Access Contoller (MAC). | ||
49 | * The hfa384x is a portion of the Harris PRISM(tm) WLAN chipset. | ||
50 | * | ||
51 | * [Implementation and usage notes] | ||
52 | * | ||
53 | * [References] | ||
54 | * CW10 Programmer's Manual v1.5 | ||
55 | * IEEE 802.11 D10.0 | ||
56 | * | ||
57 | * -------------------------------------------------------------------- | ||
58 | */ | ||
59 | |||
60 | #ifndef _PRISM2MGMT_H | ||
61 | #define _PRISM2MGMT_H | ||
62 | |||
63 | |||
64 | /*=============================================================*/ | ||
65 | /*------ Constants --------------------------------------------*/ | ||
66 | |||
67 | /*=============================================================*/ | ||
68 | /*------ Macros -----------------------------------------------*/ | ||
69 | |||
70 | /*=============================================================*/ | ||
71 | /*------ Types and their related constants --------------------*/ | ||
72 | |||
73 | /*=============================================================*/ | ||
74 | /*------ Static variable externs ------------------------------*/ | ||
75 | |||
76 | #if (WLAN_HOSTIF != WLAN_USB) | ||
77 | extern int prism2_bap_timeout; | ||
78 | extern int prism2_irq_evread_max; | ||
79 | #endif | ||
80 | extern int prism2_debug; | ||
81 | extern int prism2_reset_holdtime; | ||
82 | extern int prism2_reset_settletime; | ||
83 | /*=============================================================*/ | ||
84 | /*--- Function Declarations -----------------------------------*/ | ||
85 | /*=============================================================*/ | ||
86 | |||
87 | UINT32 | ||
88 | prism2sta_ifstate(wlandevice_t *wlandev, UINT32 ifstate); | ||
89 | |||
90 | void | ||
91 | prism2sta_ev_dtim(wlandevice_t *wlandev); | ||
92 | void | ||
93 | prism2sta_ev_infdrop(wlandevice_t *wlandev); | ||
94 | void | ||
95 | prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
96 | void | ||
97 | prism2sta_ev_txexc(wlandevice_t *wlandev, UINT16 status); | ||
98 | void | ||
99 | prism2sta_ev_tx(wlandevice_t *wlandev, UINT16 status); | ||
100 | void | ||
101 | prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb); | ||
102 | void | ||
103 | prism2sta_ev_alloc(wlandevice_t *wlandev); | ||
104 | |||
105 | |||
106 | int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp); | ||
107 | int prism2mgmt_powermgmt(wlandevice_t *wlandev, void *msgp); | ||
108 | int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp); | ||
109 | int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp); | ||
110 | int prism2mgmt_join(wlandevice_t *wlandev, void *msgp); | ||
111 | int prism2mgmt_p2_join(wlandevice_t *wlandev, void *msgp); | ||
112 | int prism2mgmt_authenticate(wlandevice_t *wlandev, void *msgp); | ||
113 | int prism2mgmt_deauthenticate(wlandevice_t *wlandev, void *msgp); | ||
114 | int prism2mgmt_associate(wlandevice_t *wlandev, void *msgp); | ||
115 | int prism2mgmt_reassociate(wlandevice_t *wlandev, void *msgp); | ||
116 | int prism2mgmt_disassociate(wlandevice_t *wlandev, void *msgp); | ||
117 | int prism2mgmt_reset(wlandevice_t *wlandev, void *msgp); | ||
118 | int prism2mgmt_start(wlandevice_t *wlandev, void *msgp); | ||
119 | int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp); | ||
120 | int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp); | ||
121 | int prism2mgmt_readcis(wlandevice_t *wlandev, void *msgp); | ||
122 | int prism2mgmt_auxport_state(wlandevice_t *wlandev, void *msgp); | ||
123 | int prism2mgmt_auxport_read(wlandevice_t *wlandev, void *msgp); | ||
124 | int prism2mgmt_auxport_write(wlandevice_t *wlandev, void *msgp); | ||
125 | int prism2mgmt_low_level(wlandevice_t *wlandev, void *msgp); | ||
126 | int prism2mgmt_test_command(wlandevice_t *wlandev, void *msgp); | ||
127 | int prism2mgmt_mmi_read(wlandevice_t *wlandev, void *msgp); | ||
128 | int prism2mgmt_mmi_write(wlandevice_t *wlandev, void *msgp); | ||
129 | int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp); | ||
130 | int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp); | ||
131 | int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp); | ||
132 | int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp); | ||
133 | int prism2mgmt_mm_state(wlandevice_t *wlandev, void *msgp); | ||
134 | int prism2mgmt_dump_state(wlandevice_t *wlandev, void *msgp); | ||
135 | int prism2mgmt_enable(wlandevice_t *wlandev, void *msgp); | ||
136 | int prism2mgmt_channel_info(wlandevice_t *wlandev, void *msgp); | ||
137 | int prism2mgmt_channel_info_results(wlandevice_t *wlandev, void *msgp); | ||
138 | int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp); | ||
139 | |||
140 | /*--------------------------------------------------------------- | ||
141 | * conversion functions going between wlan message data types and | ||
142 | * Prism2 data types | ||
143 | ---------------------------------------------------------------*/ | ||
144 | /* byte area conversion functions*/ | ||
145 | void prism2mgmt_pstr2bytearea(UINT8 *bytearea, p80211pstrd_t *pstr); | ||
146 | void prism2mgmt_bytearea2pstr(UINT8 *bytearea, p80211pstrd_t *pstr, int len); | ||
147 | |||
148 | /* byte string conversion functions*/ | ||
149 | void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr); | ||
150 | void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr); | ||
151 | |||
152 | /* integer conversion functions */ | ||
153 | void prism2mgmt_prism2int2p80211int(UINT16 *prism2int, UINT32 *wlanint); | ||
154 | void prism2mgmt_p80211int2prism2int(UINT16 *prism2int, UINT32 *wlanint); | ||
155 | |||
156 | /* enumerated integer conversion functions */ | ||
157 | void prism2mgmt_prism2enum2p80211enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid); | ||
158 | void prism2mgmt_p80211enum2prism2enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid); | ||
159 | |||
160 | /* functions to convert a bit area to/from an Operational Rate Set */ | ||
161 | void prism2mgmt_get_oprateset(UINT16 *rate, p80211pstrd_t *pstr); | ||
162 | void prism2mgmt_set_oprateset(UINT16 *rate, p80211pstrd_t *pstr); | ||
163 | |||
164 | /* functions to convert Group Addresses */ | ||
165 | void prism2mgmt_get_grpaddr(UINT32 did, | ||
166 | p80211pstrd_t *pstr, hfa384x_t *priv ); | ||
167 | int prism2mgmt_set_grpaddr(UINT32 did, | ||
168 | UINT8 *prism2buf, p80211pstrd_t *pstr, hfa384x_t *priv ); | ||
169 | int prism2mgmt_get_grpaddr_index( UINT32 did ); | ||
170 | |||
171 | void prism2sta_processing_defer(struct work_struct *data); | ||
172 | |||
173 | void prism2sta_commsqual_defer(struct work_struct *data); | ||
174 | void prism2sta_commsqual_timer(unsigned long data); | ||
175 | |||
176 | /*=============================================================*/ | ||
177 | /*--- Inline Function Definitions (if supported) --------------*/ | ||
178 | /*=============================================================*/ | ||
179 | |||
180 | |||
181 | |||
182 | #endif | ||
diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c new file mode 100644 index 000000000000..268fd9bba1ef --- /dev/null +++ b/drivers/staging/wlan-ng/prism2mib.c | |||
@@ -0,0 +1,3799 @@ | |||
1 | /* src/prism2/driver/prism2mib.c | ||
2 | * | ||
3 | * Management request for mibset/mibget | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * The functions in this file handle the mibset/mibget management | ||
48 | * functions. | ||
49 | * | ||
50 | * -------------------------------------------------------------------- | ||
51 | */ | ||
52 | |||
53 | /*================================================================*/ | ||
54 | /* System Includes */ | ||
55 | #define WLAN_DBVAR prism2_debug | ||
56 | |||
57 | #include "version.h" | ||
58 | |||
59 | |||
60 | #include <linux/version.h> | ||
61 | |||
62 | #include <linux/module.h> | ||
63 | #include <linux/kernel.h> | ||
64 | #include <linux/sched.h> | ||
65 | #include <linux/types.h> | ||
66 | #include <linux/slab.h> | ||
67 | #include <linux/wireless.h> | ||
68 | #include <linux/netdevice.h> | ||
69 | #include <asm/io.h> | ||
70 | #include <linux/delay.h> | ||
71 | #include <asm/byteorder.h> | ||
72 | |||
73 | #include "wlan_compat.h" | ||
74 | |||
75 | //#if (WLAN_HOSTIF == WLAN_PCMCIA) | ||
76 | //#include <pcmcia/version.h> | ||
77 | //#include <pcmcia/cs_types.h> | ||
78 | //#include <pcmcia/cs.h> | ||
79 | //#include <pcmcia/cistpl.h> | ||
80 | //#include <pcmcia/ds.h> | ||
81 | //#include <pcmcia/cisreg.h> | ||
82 | //#endif | ||
83 | // | ||
84 | //#if ((WLAN_HOSTIF == WLAN_PLX) || (WLAN_HOSTIF == WLAN_PCI)) | ||
85 | //#include <linux/ioport.h> | ||
86 | //#include <linux/pci.h> | ||
87 | //endif | ||
88 | |||
89 | //#if (WLAN_HOSTIF == WLAN_USB) | ||
90 | #include <linux/usb.h> | ||
91 | //#endif | ||
92 | |||
93 | #include "wlan_compat.h" | ||
94 | |||
95 | /*================================================================*/ | ||
96 | /* Project Includes */ | ||
97 | |||
98 | #include "p80211types.h" | ||
99 | #include "p80211hdr.h" | ||
100 | #include "p80211mgmt.h" | ||
101 | #include "p80211conv.h" | ||
102 | #include "p80211msg.h" | ||
103 | #include "p80211netdev.h" | ||
104 | #include "p80211metadef.h" | ||
105 | #include "p80211metastruct.h" | ||
106 | #include "hfa384x.h" | ||
107 | #include "prism2mgmt.h" | ||
108 | |||
109 | /*================================================================*/ | ||
110 | /* Local Constants */ | ||
111 | |||
112 | #define MIB_TMP_MAXLEN 200 /* Max length of RID record (in bytes). */ | ||
113 | |||
114 | /*================================================================*/ | ||
115 | /* Local Types */ | ||
116 | |||
117 | #define F_AP 0x1 /* MIB is supported on Access Points. */ | ||
118 | #define F_STA 0x2 /* MIB is supported on stations. */ | ||
119 | #define F_READ 0x4 /* MIB may be read. */ | ||
120 | #define F_WRITE 0x8 /* MIB may be written. */ | ||
121 | |||
122 | typedef struct mibrec | ||
123 | { | ||
124 | UINT32 did; | ||
125 | UINT16 flag; | ||
126 | UINT16 parm1; | ||
127 | UINT16 parm2; | ||
128 | UINT16 parm3; | ||
129 | int (*func)(struct mibrec *mib, | ||
130 | int isget, | ||
131 | wlandevice_t *wlandev, | ||
132 | hfa384x_t *hw, | ||
133 | p80211msg_dot11req_mibset_t *msg, | ||
134 | void *data); | ||
135 | } mibrec_t; | ||
136 | |||
137 | /*================================================================*/ | ||
138 | /* Local Function Declarations */ | ||
139 | |||
140 | static int prism2mib_bytestr2pstr( | ||
141 | mibrec_t *mib, | ||
142 | int isget, | ||
143 | wlandevice_t *wlandev, | ||
144 | hfa384x_t *hw, | ||
145 | p80211msg_dot11req_mibset_t *msg, | ||
146 | void *data); | ||
147 | |||
148 | static int prism2mib_bytearea2pstr( | ||
149 | mibrec_t *mib, | ||
150 | int isget, | ||
151 | wlandevice_t *wlandev, | ||
152 | hfa384x_t *hw, | ||
153 | p80211msg_dot11req_mibset_t *msg, | ||
154 | void *data); | ||
155 | |||
156 | static int prism2mib_uint32( | ||
157 | mibrec_t *mib, | ||
158 | int isget, | ||
159 | wlandevice_t *wlandev, | ||
160 | hfa384x_t *hw, | ||
161 | p80211msg_dot11req_mibset_t *msg, | ||
162 | void *data); | ||
163 | |||
164 | static int prism2mib_uint32array( | ||
165 | mibrec_t *mib, | ||
166 | int isget, | ||
167 | wlandevice_t *wlandev, | ||
168 | hfa384x_t *hw, | ||
169 | p80211msg_dot11req_mibset_t *msg, | ||
170 | void *data); | ||
171 | |||
172 | static int prism2mib_uint32offset( | ||
173 | mibrec_t *mib, | ||
174 | int isget, | ||
175 | wlandevice_t *wlandev, | ||
176 | hfa384x_t *hw, | ||
177 | p80211msg_dot11req_mibset_t *msg, | ||
178 | void *data); | ||
179 | |||
180 | static int prism2mib_truth( | ||
181 | mibrec_t *mib, | ||
182 | int isget, | ||
183 | wlandevice_t *wlandev, | ||
184 | hfa384x_t *hw, | ||
185 | p80211msg_dot11req_mibset_t *msg, | ||
186 | void *data); | ||
187 | |||
188 | static int prism2mib_preamble( | ||
189 | mibrec_t *mib, | ||
190 | int isget, | ||
191 | wlandevice_t *wlandev, | ||
192 | hfa384x_t *hw, | ||
193 | p80211msg_dot11req_mibset_t *msg, | ||
194 | void *data); | ||
195 | |||
196 | static int prism2mib_flag( | ||
197 | mibrec_t *mib, | ||
198 | int isget, | ||
199 | wlandevice_t *wlandev, | ||
200 | hfa384x_t *hw, | ||
201 | p80211msg_dot11req_mibset_t *msg, | ||
202 | void *data); | ||
203 | |||
204 | static int prism2mib_appcfinfoflag( | ||
205 | mibrec_t *mib, | ||
206 | int isget, | ||
207 | wlandevice_t *wlandev, | ||
208 | hfa384x_t *hw, | ||
209 | p80211msg_dot11req_mibset_t *msg, | ||
210 | void *data); | ||
211 | |||
212 | static int prism2mib_regulatorydomains( | ||
213 | mibrec_t *mib, | ||
214 | int isget, | ||
215 | wlandevice_t *wlandev, | ||
216 | hfa384x_t *hw, | ||
217 | p80211msg_dot11req_mibset_t *msg, | ||
218 | void *data); | ||
219 | |||
220 | static int prism2mib_wepdefaultkey( | ||
221 | mibrec_t *mib, | ||
222 | int isget, | ||
223 | wlandevice_t *wlandev, | ||
224 | hfa384x_t *hw, | ||
225 | p80211msg_dot11req_mibset_t *msg, | ||
226 | void *data); | ||
227 | |||
228 | static int prism2mib_powermanagement( | ||
229 | mibrec_t *mib, | ||
230 | int isget, | ||
231 | wlandevice_t *wlandev, | ||
232 | hfa384x_t *hw, | ||
233 | p80211msg_dot11req_mibset_t *msg, | ||
234 | void *data); | ||
235 | |||
236 | static int prism2mib_privacyinvoked( | ||
237 | mibrec_t *mib, | ||
238 | int isget, | ||
239 | wlandevice_t *wlandev, | ||
240 | hfa384x_t *hw, | ||
241 | p80211msg_dot11req_mibset_t *msg, | ||
242 | void *data); | ||
243 | |||
244 | static int prism2mib_excludeunencrypted( | ||
245 | mibrec_t *mib, | ||
246 | int isget, | ||
247 | wlandevice_t *wlandev, | ||
248 | hfa384x_t *hw, | ||
249 | p80211msg_dot11req_mibset_t *msg, | ||
250 | void *data); | ||
251 | |||
252 | static int prism2mib_fragmentationthreshold( | ||
253 | mibrec_t *mib, | ||
254 | int isget, | ||
255 | wlandevice_t *wlandev, | ||
256 | hfa384x_t *hw, | ||
257 | p80211msg_dot11req_mibset_t *msg, | ||
258 | void *data); | ||
259 | |||
260 | static int prism2mib_operationalrateset( | ||
261 | mibrec_t *mib, | ||
262 | int isget, | ||
263 | wlandevice_t *wlandev, | ||
264 | hfa384x_t *hw, | ||
265 | p80211msg_dot11req_mibset_t *msg, | ||
266 | void *data); | ||
267 | |||
268 | static int prism2mib_groupaddress( | ||
269 | mibrec_t *mib, | ||
270 | int isget, | ||
271 | wlandevice_t *wlandev, | ||
272 | hfa384x_t *hw, | ||
273 | p80211msg_dot11req_mibset_t *msg, | ||
274 | void *data); | ||
275 | |||
276 | static int prism2mib_fwid( | ||
277 | mibrec_t *mib, | ||
278 | int isget, | ||
279 | wlandevice_t *wlandev, | ||
280 | hfa384x_t *hw, | ||
281 | p80211msg_dot11req_mibset_t *msg, | ||
282 | void *data); | ||
283 | |||
284 | static int prism2mib_authalg( | ||
285 | mibrec_t *mib, | ||
286 | int isget, | ||
287 | wlandevice_t *wlandev, | ||
288 | hfa384x_t *hw, | ||
289 | p80211msg_dot11req_mibset_t *msg, | ||
290 | void *data); | ||
291 | |||
292 | static int prism2mib_authalgenable( | ||
293 | mibrec_t *mib, | ||
294 | int isget, | ||
295 | wlandevice_t *wlandev, | ||
296 | hfa384x_t *hw, | ||
297 | p80211msg_dot11req_mibset_t *msg, | ||
298 | void *data); | ||
299 | |||
300 | static int prism2mib_priv( | ||
301 | mibrec_t *mib, | ||
302 | int isget, | ||
303 | wlandevice_t *wlandev, | ||
304 | hfa384x_t *hw, | ||
305 | p80211msg_dot11req_mibset_t *msg, | ||
306 | void *data); | ||
307 | |||
308 | static void prism2mib_priv_authlist( | ||
309 | hfa384x_t *hw, | ||
310 | prism2sta_authlist_t *list); | ||
311 | |||
312 | static void prism2mib_priv_accessmode( | ||
313 | hfa384x_t *hw, | ||
314 | UINT32 mode); | ||
315 | |||
316 | static void prism2mib_priv_accessallow( | ||
317 | hfa384x_t *hw, | ||
318 | p80211macarray_t *macarray); | ||
319 | |||
320 | static void prism2mib_priv_accessdeny( | ||
321 | hfa384x_t *hw, | ||
322 | p80211macarray_t *macarray); | ||
323 | |||
324 | static void prism2mib_priv_deauthenticate( | ||
325 | hfa384x_t *hw, | ||
326 | UINT8 *addr); | ||
327 | |||
328 | /*================================================================*/ | ||
329 | /* Local Static Definitions */ | ||
330 | |||
331 | static mibrec_t mibtab[] = { | ||
332 | |||
333 | /* dot11smt MIB's */ | ||
334 | |||
335 | { DIDmib_dot11smt_dot11StationConfigTable_dot11StationID, | ||
336 | F_AP | F_STA | F_READ | F_WRITE, | ||
337 | HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0, | ||
338 | prism2mib_bytearea2pstr }, | ||
339 | { DIDmib_dot11smt_dot11StationConfigTable_dot11MediumOccupancyLimit, | ||
340 | F_AP | F_READ | F_WRITE, | ||
341 | HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 0, | ||
342 | prism2mib_uint32offset }, | ||
343 | { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPollable, | ||
344 | F_STA | F_READ, | ||
345 | HFA384x_RID_CFPOLLABLE, 0, 0, | ||
346 | prism2mib_uint32 }, | ||
347 | { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPPeriod, | ||
348 | F_AP | F_READ | F_WRITE, | ||
349 | HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 1, | ||
350 | prism2mib_uint32offset }, | ||
351 | { DIDmib_dot11smt_dot11StationConfigTable_dot11CFPMaxDuration, | ||
352 | F_AP | F_READ | F_WRITE, | ||
353 | HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 2, | ||
354 | prism2mib_uint32offset }, | ||
355 | { DIDmib_dot11smt_dot11StationConfigTable_dot11AuthenticationResponseTimeOut, | ||
356 | F_STA | F_READ | F_WRITE, | ||
357 | HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0, | ||
358 | prism2mib_uint32 }, | ||
359 | { DIDmib_dot11smt_dot11StationConfigTable_dot11PrivacyOptionImplemented, | ||
360 | F_AP | F_STA | F_READ, | ||
361 | HFA384x_RID_PRIVACYOPTIMP, 0, 0, | ||
362 | prism2mib_uint32 }, | ||
363 | { DIDmib_dot11smt_dot11StationConfigTable_dot11PowerManagementMode, | ||
364 | F_STA | F_READ | F_WRITE, | ||
365 | HFA384x_RID_CNFPMENABLED, 0, 0, | ||
366 | prism2mib_powermanagement }, | ||
367 | { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredSSID, | ||
368 | F_STA | F_READ | F_WRITE, | ||
369 | HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0, | ||
370 | prism2mib_bytestr2pstr }, | ||
371 | { DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType, | ||
372 | F_STA | F_READ | F_WRITE, | ||
373 | 0, 0, 0, | ||
374 | prism2mib_priv }, | ||
375 | { DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet, | ||
376 | F_STA | F_READ | F_WRITE, | ||
377 | HFA384x_RID_TXRATECNTL, 0, 0, | ||
378 | prism2mib_operationalrateset }, | ||
379 | { DIDmib_dot11smt_dot11StationConfigTable_dot11OperationalRateSet, | ||
380 | F_AP | F_READ | F_WRITE, | ||
381 | HFA384x_RID_TXRATECNTL0, 0, 0, | ||
382 | prism2mib_operationalrateset }, | ||
383 | { DIDmib_dot11smt_dot11StationConfigTable_dot11BeaconPeriod, | ||
384 | F_AP | F_READ | F_WRITE, | ||
385 | HFA384x_RID_CNFAPBCNINT, 0, 0, | ||
386 | prism2mib_uint32 }, | ||
387 | { DIDmib_dot11smt_dot11StationConfigTable_dot11DTIMPeriod, | ||
388 | F_AP | F_STA | F_READ | F_WRITE, | ||
389 | HFA384x_RID_CNFOWNDTIMPER, 0, 0, | ||
390 | prism2mib_uint32 }, | ||
391 | { DIDmib_dot11smt_dot11StationConfigTable_dot11AssociationResponseTimeOut, | ||
392 | F_AP | F_STA | F_READ, | ||
393 | HFA384x_RID_PROTOCOLRSPTIME, 0, 0, | ||
394 | prism2mib_uint32 }, | ||
395 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm1, | ||
396 | F_AP | F_STA | F_READ, | ||
397 | 1, 0, 0, | ||
398 | prism2mib_authalg }, | ||
399 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm2, | ||
400 | F_AP | F_STA | F_READ, | ||
401 | 2, 0, 0, | ||
402 | prism2mib_authalg }, | ||
403 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm3, | ||
404 | F_AP | F_STA | F_READ, | ||
405 | 3, 0, 0, | ||
406 | prism2mib_authalg }, | ||
407 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm4, | ||
408 | F_AP | F_STA | F_READ, | ||
409 | 4, 0, 0, | ||
410 | prism2mib_authalg }, | ||
411 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm5, | ||
412 | F_AP | F_STA | F_READ, | ||
413 | 5, 0, 0, | ||
414 | prism2mib_authalg }, | ||
415 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithm6, | ||
416 | F_AP | F_STA | F_READ, | ||
417 | 6, 0, 0, | ||
418 | prism2mib_authalg }, | ||
419 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable1, | ||
420 | F_AP | F_STA | F_READ | F_WRITE, | ||
421 | 1, 0, 0, | ||
422 | prism2mib_authalgenable }, | ||
423 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable2, | ||
424 | F_AP | F_STA | F_READ | F_WRITE, | ||
425 | 2, 0, 0, | ||
426 | prism2mib_authalgenable }, | ||
427 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable3, | ||
428 | F_AP | F_STA | F_READ | F_WRITE, | ||
429 | 3, 0, 0, | ||
430 | prism2mib_authalgenable }, | ||
431 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable4, | ||
432 | F_AP | F_STA | F_READ | F_WRITE, | ||
433 | 4, 0, 0, | ||
434 | prism2mib_authalgenable }, | ||
435 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable5, | ||
436 | F_AP | F_STA | F_READ | F_WRITE, | ||
437 | 5, 0, 0, | ||
438 | prism2mib_authalgenable }, | ||
439 | { DIDmib_dot11smt_dot11AuthenticationAlgorithmsTable_dot11AuthenticationAlgorithmsEnable6, | ||
440 | F_AP | F_STA | F_READ | F_WRITE, | ||
441 | 6, 0, 0, | ||
442 | prism2mib_authalgenable }, | ||
443 | { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0, | ||
444 | F_AP | F_STA | F_WRITE, | ||
445 | HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0, | ||
446 | prism2mib_wepdefaultkey }, | ||
447 | { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1, | ||
448 | F_AP | F_STA | F_WRITE, | ||
449 | HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0, | ||
450 | prism2mib_wepdefaultkey }, | ||
451 | { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2, | ||
452 | F_AP | F_STA | F_WRITE, | ||
453 | HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0, | ||
454 | prism2mib_wepdefaultkey }, | ||
455 | { DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3, | ||
456 | F_AP | F_STA | F_WRITE, | ||
457 | HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0, | ||
458 | prism2mib_wepdefaultkey }, | ||
459 | { DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked, | ||
460 | F_AP | F_STA | F_READ | F_WRITE, | ||
461 | HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_PRIVINVOKED, 0, | ||
462 | prism2mib_privacyinvoked }, | ||
463 | { DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID, | ||
464 | F_AP | F_STA | F_READ | F_WRITE, | ||
465 | HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0, | ||
466 | prism2mib_uint32 }, | ||
467 | { DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted, | ||
468 | F_AP | F_STA | F_READ | F_WRITE, | ||
469 | HFA384x_RID_CNFWEPFLAGS, HFA384x_WEPFLAGS_EXCLUDE, 0, | ||
470 | prism2mib_excludeunencrypted }, | ||
471 | { DIDmib_dot11phy_dot11PhyOperationTable_dot11ShortPreambleEnabled, | ||
472 | F_AP | F_STA | F_READ | F_WRITE, | ||
473 | HFA384x_RID_CNFSHORTPREAMBLE, 0, 0, | ||
474 | prism2mib_preamble }, | ||
475 | |||
476 | /* dot11mac MIB's */ | ||
477 | |||
478 | { DIDmib_dot11mac_dot11OperationTable_dot11MACAddress, | ||
479 | F_AP | F_STA | F_READ | F_WRITE, | ||
480 | HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0, | ||
481 | prism2mib_bytearea2pstr }, | ||
482 | { DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold, | ||
483 | F_STA | F_READ | F_WRITE, | ||
484 | HFA384x_RID_RTSTHRESH, 0, 0, | ||
485 | prism2mib_uint32 }, | ||
486 | { DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold, | ||
487 | F_AP | F_READ | F_WRITE, | ||
488 | HFA384x_RID_RTSTHRESH0, 0, 0, | ||
489 | prism2mib_uint32 }, | ||
490 | { DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit, | ||
491 | F_AP | F_STA | F_READ, | ||
492 | HFA384x_RID_SHORTRETRYLIMIT, 0, 0, | ||
493 | prism2mib_uint32 }, | ||
494 | { DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit, | ||
495 | F_AP | F_STA | F_READ, | ||
496 | HFA384x_RID_LONGRETRYLIMIT, 0, 0, | ||
497 | prism2mib_uint32 }, | ||
498 | { DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold, | ||
499 | F_STA | F_READ | F_WRITE, | ||
500 | HFA384x_RID_FRAGTHRESH, 0, 0, | ||
501 | prism2mib_fragmentationthreshold }, | ||
502 | { DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold, | ||
503 | F_AP | F_READ | F_WRITE, | ||
504 | HFA384x_RID_FRAGTHRESH0, 0, 0, | ||
505 | prism2mib_fragmentationthreshold }, | ||
506 | { DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime, | ||
507 | F_AP | F_STA | F_READ, | ||
508 | HFA384x_RID_MAXTXLIFETIME, 0, 0, | ||
509 | prism2mib_uint32 }, | ||
510 | { DIDmib_dot11mac_dot11OperationTable_dot11MaxReceiveLifetime, | ||
511 | F_AP | F_STA | F_READ, | ||
512 | HFA384x_RID_MAXRXLIFETIME, 0, 0, | ||
513 | prism2mib_uint32 }, | ||
514 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1, | ||
515 | F_STA | F_READ | F_WRITE, | ||
516 | 0, 0, 0, | ||
517 | prism2mib_groupaddress }, | ||
518 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2, | ||
519 | F_STA | F_READ | F_WRITE, | ||
520 | 0, 0, 0, | ||
521 | prism2mib_groupaddress }, | ||
522 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3, | ||
523 | F_STA | F_READ | F_WRITE, | ||
524 | 0, 0, 0, | ||
525 | prism2mib_groupaddress }, | ||
526 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4, | ||
527 | F_STA | F_READ | F_WRITE, | ||
528 | 0, 0, 0, | ||
529 | prism2mib_groupaddress }, | ||
530 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5, | ||
531 | F_STA | F_READ | F_WRITE, | ||
532 | 0, 0, 0, | ||
533 | prism2mib_groupaddress }, | ||
534 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6, | ||
535 | F_STA | F_READ | F_WRITE, | ||
536 | 0, 0, 0, | ||
537 | prism2mib_groupaddress }, | ||
538 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7, | ||
539 | F_STA | F_READ | F_WRITE, | ||
540 | 0, 0, 0, | ||
541 | prism2mib_groupaddress }, | ||
542 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8, | ||
543 | F_STA | F_READ | F_WRITE, | ||
544 | 0, 0, 0, | ||
545 | prism2mib_groupaddress }, | ||
546 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9, | ||
547 | F_STA | F_READ | F_WRITE, | ||
548 | 0, 0, 0, | ||
549 | prism2mib_groupaddress }, | ||
550 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10, | ||
551 | F_STA | F_READ | F_WRITE, | ||
552 | 0, 0, 0, | ||
553 | prism2mib_groupaddress }, | ||
554 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11, | ||
555 | F_STA | F_READ | F_WRITE, | ||
556 | 0, 0, 0, | ||
557 | prism2mib_groupaddress }, | ||
558 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12, | ||
559 | F_STA | F_READ | F_WRITE, | ||
560 | 0, 0, 0, | ||
561 | prism2mib_groupaddress }, | ||
562 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13, | ||
563 | F_STA | F_READ | F_WRITE, | ||
564 | 0, 0, 0, | ||
565 | prism2mib_groupaddress }, | ||
566 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14, | ||
567 | F_STA | F_READ | F_WRITE, | ||
568 | 0, 0, 0, | ||
569 | prism2mib_groupaddress }, | ||
570 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15, | ||
571 | F_STA | F_READ | F_WRITE, | ||
572 | 0, 0, 0, | ||
573 | prism2mib_groupaddress }, | ||
574 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16, | ||
575 | F_STA | F_READ | F_WRITE, | ||
576 | 0, 0, 0, | ||
577 | prism2mib_groupaddress }, | ||
578 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17, | ||
579 | F_STA | F_READ | F_WRITE, | ||
580 | 0, 0, 0, | ||
581 | prism2mib_groupaddress }, | ||
582 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18, | ||
583 | F_STA | F_READ | F_WRITE, | ||
584 | 0, 0, 0, | ||
585 | prism2mib_groupaddress }, | ||
586 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19, | ||
587 | F_STA | F_READ | F_WRITE, | ||
588 | 0, 0, 0, | ||
589 | prism2mib_groupaddress }, | ||
590 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20, | ||
591 | F_STA | F_READ | F_WRITE, | ||
592 | 0, 0, 0, | ||
593 | prism2mib_groupaddress }, | ||
594 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21, | ||
595 | F_STA | F_READ | F_WRITE, | ||
596 | 0, 0, 0, | ||
597 | prism2mib_groupaddress }, | ||
598 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22, | ||
599 | F_STA | F_READ | F_WRITE, | ||
600 | 0, 0, 0, | ||
601 | prism2mib_groupaddress }, | ||
602 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23, | ||
603 | F_STA | F_READ | F_WRITE, | ||
604 | 0, 0, 0, | ||
605 | prism2mib_groupaddress }, | ||
606 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24, | ||
607 | F_STA | F_READ | F_WRITE, | ||
608 | 0, 0, 0, | ||
609 | prism2mib_groupaddress }, | ||
610 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25, | ||
611 | F_STA | F_READ | F_WRITE, | ||
612 | 0, 0, 0, | ||
613 | prism2mib_groupaddress }, | ||
614 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26, | ||
615 | F_STA | F_READ | F_WRITE, | ||
616 | 0, 0, 0, | ||
617 | prism2mib_groupaddress }, | ||
618 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27, | ||
619 | F_STA | F_READ | F_WRITE, | ||
620 | 0, 0, 0, | ||
621 | prism2mib_groupaddress }, | ||
622 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28, | ||
623 | F_STA | F_READ | F_WRITE, | ||
624 | 0, 0, 0, | ||
625 | prism2mib_groupaddress }, | ||
626 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29, | ||
627 | F_STA | F_READ | F_WRITE, | ||
628 | 0, 0, 0, | ||
629 | prism2mib_groupaddress }, | ||
630 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30, | ||
631 | F_STA | F_READ | F_WRITE, | ||
632 | 0, 0, 0, | ||
633 | prism2mib_groupaddress }, | ||
634 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31, | ||
635 | F_STA | F_READ | F_WRITE, | ||
636 | 0, 0, 0, | ||
637 | prism2mib_groupaddress }, | ||
638 | { DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32, | ||
639 | F_STA | F_READ | F_WRITE, | ||
640 | 0, 0, 0, | ||
641 | prism2mib_groupaddress }, | ||
642 | |||
643 | /* dot11phy MIB's */ | ||
644 | |||
645 | { DIDmib_dot11phy_dot11PhyOperationTable_dot11PHYType, | ||
646 | F_AP | F_STA | F_READ, | ||
647 | HFA384x_RID_PHYTYPE, 0, 0, | ||
648 | prism2mib_uint32 }, | ||
649 | { DIDmib_dot11phy_dot11PhyOperationTable_dot11TempType, | ||
650 | F_AP | F_STA | F_READ, | ||
651 | HFA384x_RID_TEMPTYPE, 0, 0, | ||
652 | prism2mib_uint32 }, | ||
653 | { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel, | ||
654 | F_STA | F_READ, | ||
655 | HFA384x_RID_CURRENTCHANNEL, 0, 0, | ||
656 | prism2mib_uint32 }, | ||
657 | { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel, | ||
658 | F_AP | F_READ, | ||
659 | HFA384x_RID_CNFOWNCHANNEL, 0, 0, | ||
660 | prism2mib_uint32 }, | ||
661 | { DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentCCAMode, | ||
662 | F_AP | F_STA | F_READ, | ||
663 | HFA384x_RID_CCAMODE, 0, 0, | ||
664 | prism2mib_uint32 }, | ||
665 | |||
666 | /* p2Table MIB's */ | ||
667 | |||
668 | { DIDmib_p2_p2Table_p2MMTx, | ||
669 | F_AP | F_STA | F_READ | F_WRITE, | ||
670 | 0, 0, 0, | ||
671 | prism2mib_priv }, | ||
672 | { DIDmib_p2_p2Table_p2EarlyBeacon, | ||
673 | F_AP | F_READ | F_WRITE, | ||
674 | BIT7, 0, 0, | ||
675 | prism2mib_appcfinfoflag }, | ||
676 | { DIDmib_p2_p2Table_p2ReceivedFrameStatistics, | ||
677 | F_AP | F_STA | F_READ, | ||
678 | 0, 0, 0, | ||
679 | prism2mib_priv }, | ||
680 | { DIDmib_p2_p2Table_p2CommunicationTallies, | ||
681 | F_AP | F_STA | F_READ, | ||
682 | 0, 0, 0, | ||
683 | prism2mib_priv }, | ||
684 | { DIDmib_p2_p2Table_p2Authenticated, | ||
685 | F_AP | F_READ, | ||
686 | 0, 0, 0, | ||
687 | prism2mib_priv }, | ||
688 | { DIDmib_p2_p2Table_p2Associated, | ||
689 | F_AP | F_READ, | ||
690 | 0, 0, 0, | ||
691 | prism2mib_priv }, | ||
692 | { DIDmib_p2_p2Table_p2PowerSaveUserCount, | ||
693 | F_AP | F_READ, | ||
694 | 0, 0, 0, | ||
695 | prism2mib_priv }, | ||
696 | { DIDmib_p2_p2Table_p2Comment, | ||
697 | F_AP | F_STA | F_READ | F_WRITE, | ||
698 | 0, 0, 0, | ||
699 | prism2mib_priv }, | ||
700 | { DIDmib_p2_p2Table_p2AccessMode, | ||
701 | F_AP | F_READ | F_WRITE, | ||
702 | 0, 0, 0, | ||
703 | prism2mib_priv }, | ||
704 | { DIDmib_p2_p2Table_p2AccessAllow, | ||
705 | F_AP | F_READ | F_WRITE, | ||
706 | 0, 0, 0, | ||
707 | prism2mib_priv }, | ||
708 | { DIDmib_p2_p2Table_p2AccessDeny, | ||
709 | F_AP | F_READ | F_WRITE, | ||
710 | 0, 0, 0, | ||
711 | prism2mib_priv }, | ||
712 | { DIDmib_p2_p2Table_p2ChannelInfoResults, | ||
713 | F_AP | F_READ, | ||
714 | 0, 0, 0, | ||
715 | prism2mib_priv }, | ||
716 | |||
717 | /* p2Static MIB's */ | ||
718 | |||
719 | { DIDmib_p2_p2Static_p2CnfPortType, | ||
720 | F_STA | F_READ | F_WRITE, | ||
721 | HFA384x_RID_CNFPORTTYPE, 0, 0, | ||
722 | prism2mib_uint32 }, | ||
723 | { DIDmib_p2_p2Static_p2CnfOwnMACAddress, | ||
724 | F_AP | F_STA | F_READ | F_WRITE, | ||
725 | HFA384x_RID_CNFOWNMACADDR, HFA384x_RID_CNFOWNMACADDR_LEN, 0, | ||
726 | prism2mib_bytearea2pstr }, | ||
727 | { DIDmib_p2_p2Static_p2CnfDesiredSSID, | ||
728 | F_STA | F_READ | F_WRITE, | ||
729 | HFA384x_RID_CNFDESIREDSSID, HFA384x_RID_CNFDESIREDSSID_LEN, 0, | ||
730 | prism2mib_bytestr2pstr }, | ||
731 | { DIDmib_p2_p2Static_p2CnfOwnChannel, | ||
732 | F_AP | F_STA | F_READ | F_WRITE, | ||
733 | HFA384x_RID_CNFOWNCHANNEL, 0, 0, | ||
734 | prism2mib_uint32 }, | ||
735 | { DIDmib_p2_p2Static_p2CnfOwnSSID, | ||
736 | F_AP | F_STA | F_READ | F_WRITE, | ||
737 | HFA384x_RID_CNFOWNSSID, HFA384x_RID_CNFOWNSSID_LEN, 0, | ||
738 | prism2mib_bytestr2pstr }, | ||
739 | { DIDmib_p2_p2Static_p2CnfOwnATIMWindow, | ||
740 | F_STA | F_READ | F_WRITE, | ||
741 | HFA384x_RID_CNFOWNATIMWIN, 0, 0, | ||
742 | prism2mib_uint32 }, | ||
743 | { DIDmib_p2_p2Static_p2CnfSystemScale, | ||
744 | F_AP | F_STA | F_READ | F_WRITE, | ||
745 | HFA384x_RID_CNFSYSSCALE, 0, 0, | ||
746 | prism2mib_uint32 }, | ||
747 | { DIDmib_p2_p2Static_p2CnfMaxDataLength, | ||
748 | F_AP | F_STA | F_READ | F_WRITE, | ||
749 | HFA384x_RID_CNFMAXDATALEN, 0, 0, | ||
750 | prism2mib_uint32 }, | ||
751 | { DIDmib_p2_p2Static_p2CnfWDSAddress, | ||
752 | F_STA | F_READ | F_WRITE, | ||
753 | HFA384x_RID_CNFWDSADDR, HFA384x_RID_CNFWDSADDR_LEN, 0, | ||
754 | prism2mib_bytearea2pstr }, | ||
755 | { DIDmib_p2_p2Static_p2CnfPMEnabled, | ||
756 | F_STA | F_READ | F_WRITE, | ||
757 | HFA384x_RID_CNFPMENABLED, 0, 0, | ||
758 | prism2mib_truth }, | ||
759 | { DIDmib_p2_p2Static_p2CnfPMEPS, | ||
760 | F_STA | F_READ | F_WRITE, | ||
761 | HFA384x_RID_CNFPMEPS, 0, 0, | ||
762 | prism2mib_truth }, | ||
763 | { DIDmib_p2_p2Static_p2CnfMulticastReceive, | ||
764 | F_STA | F_READ | F_WRITE, | ||
765 | HFA384x_RID_CNFMULTICASTRX, 0, 0, | ||
766 | prism2mib_truth }, | ||
767 | { DIDmib_p2_p2Static_p2CnfMaxSleepDuration, | ||
768 | F_STA | F_READ | F_WRITE, | ||
769 | HFA384x_RID_CNFMAXSLEEPDUR, 0, 0, | ||
770 | prism2mib_uint32 }, | ||
771 | { DIDmib_p2_p2Static_p2CnfPMHoldoverDuration, | ||
772 | F_STA | F_READ | F_WRITE, | ||
773 | HFA384x_RID_CNFPMHOLDDUR, 0, 0, | ||
774 | prism2mib_uint32 }, | ||
775 | { DIDmib_p2_p2Static_p2CnfOwnName, | ||
776 | F_AP | F_STA | F_READ | F_WRITE, | ||
777 | HFA384x_RID_CNFOWNNAME, HFA384x_RID_CNFOWNNAME_LEN, 0, | ||
778 | prism2mib_bytestr2pstr }, | ||
779 | { DIDmib_p2_p2Static_p2CnfOwnDTIMPeriod, | ||
780 | F_AP | F_STA | F_READ | F_WRITE, | ||
781 | HFA384x_RID_CNFOWNDTIMPER, 0, 0, | ||
782 | prism2mib_uint32 }, | ||
783 | { DIDmib_p2_p2Static_p2CnfWDSAddress1, | ||
784 | F_AP | F_READ | F_WRITE, | ||
785 | HFA384x_RID_CNFWDSADDR1, HFA384x_RID_CNFWDSADDR1_LEN, 0, | ||
786 | prism2mib_bytearea2pstr }, | ||
787 | { DIDmib_p2_p2Static_p2CnfWDSAddress2, | ||
788 | F_AP | F_READ | F_WRITE, | ||
789 | HFA384x_RID_CNFWDSADDR2, HFA384x_RID_CNFWDSADDR2_LEN, 0, | ||
790 | prism2mib_bytearea2pstr }, | ||
791 | { DIDmib_p2_p2Static_p2CnfWDSAddress3, | ||
792 | F_AP | F_READ | F_WRITE, | ||
793 | HFA384x_RID_CNFWDSADDR3, HFA384x_RID_CNFWDSADDR3_LEN, 0, | ||
794 | prism2mib_bytearea2pstr }, | ||
795 | { DIDmib_p2_p2Static_p2CnfWDSAddress4, | ||
796 | F_AP | F_READ | F_WRITE, | ||
797 | HFA384x_RID_CNFWDSADDR4, HFA384x_RID_CNFWDSADDR4_LEN, 0, | ||
798 | prism2mib_bytearea2pstr }, | ||
799 | { DIDmib_p2_p2Static_p2CnfWDSAddress5, | ||
800 | F_AP | F_READ | F_WRITE, | ||
801 | HFA384x_RID_CNFWDSADDR5, HFA384x_RID_CNFWDSADDR5_LEN, 0, | ||
802 | prism2mib_bytearea2pstr }, | ||
803 | { DIDmib_p2_p2Static_p2CnfWDSAddress6, | ||
804 | F_AP | F_READ | F_WRITE, | ||
805 | HFA384x_RID_CNFWDSADDR6, HFA384x_RID_CNFWDSADDR6_LEN, 0, | ||
806 | prism2mib_bytearea2pstr }, | ||
807 | { DIDmib_p2_p2Static_p2CnfMulticastPMBuffering, | ||
808 | F_AP | F_READ | F_WRITE, | ||
809 | HFA384x_RID_CNFMCASTPMBUFF, 0, 0, | ||
810 | prism2mib_truth }, | ||
811 | { DIDmib_p2_p2Static_p2CnfWEPDefaultKeyID, | ||
812 | F_AP | F_STA | F_READ | F_WRITE, | ||
813 | HFA384x_RID_CNFWEPDEFAULTKEYID, 0, 0, | ||
814 | prism2mib_uint32 }, | ||
815 | { DIDmib_p2_p2Static_p2CnfWEPDefaultKey0, | ||
816 | F_AP | F_STA | F_WRITE, | ||
817 | HFA384x_RID_CNFWEPDEFAULTKEY0, 0, 0, | ||
818 | prism2mib_wepdefaultkey }, | ||
819 | { DIDmib_p2_p2Static_p2CnfWEPDefaultKey1, | ||
820 | F_AP | F_STA | F_WRITE, | ||
821 | HFA384x_RID_CNFWEPDEFAULTKEY1, 0, 0, | ||
822 | prism2mib_wepdefaultkey }, | ||
823 | { DIDmib_p2_p2Static_p2CnfWEPDefaultKey2, | ||
824 | F_AP | F_STA | F_WRITE, | ||
825 | HFA384x_RID_CNFWEPDEFAULTKEY2, 0, 0, | ||
826 | prism2mib_wepdefaultkey }, | ||
827 | { DIDmib_p2_p2Static_p2CnfWEPDefaultKey3, | ||
828 | F_AP | F_STA | F_WRITE, | ||
829 | HFA384x_RID_CNFWEPDEFAULTKEY3, 0, 0, | ||
830 | prism2mib_wepdefaultkey }, | ||
831 | { DIDmib_p2_p2Static_p2CnfWEPFlags, | ||
832 | F_AP | F_STA | F_READ | F_WRITE, | ||
833 | HFA384x_RID_CNFWEPFLAGS, 0, 0, | ||
834 | prism2mib_uint32 }, | ||
835 | { DIDmib_p2_p2Static_p2CnfAuthentication, | ||
836 | F_AP | F_STA | F_READ | F_WRITE, | ||
837 | HFA384x_RID_CNFAUTHENTICATION, 0, 0, | ||
838 | prism2mib_uint32 }, | ||
839 | { DIDmib_p2_p2Static_p2CnfMaxAssociatedStations, | ||
840 | F_AP | F_READ | F_WRITE, | ||
841 | HFA384x_RID_CNFMAXASSOCSTATIONS, 0, 0, | ||
842 | prism2mib_uint32 }, | ||
843 | { DIDmib_p2_p2Static_p2CnfTxControl, | ||
844 | F_AP | F_STA | F_READ | F_WRITE, | ||
845 | HFA384x_RID_CNFTXCONTROL, 0, 0, | ||
846 | prism2mib_uint32 }, | ||
847 | { DIDmib_p2_p2Static_p2CnfRoamingMode, | ||
848 | F_STA | F_READ | F_WRITE, | ||
849 | HFA384x_RID_CNFROAMINGMODE, 0, 0, | ||
850 | prism2mib_uint32 }, | ||
851 | { DIDmib_p2_p2Static_p2CnfHostAuthentication, | ||
852 | F_AP | F_READ | F_WRITE, | ||
853 | HFA384x_RID_CNFHOSTAUTHASSOC, 0, 0, | ||
854 | prism2mib_truth }, | ||
855 | { DIDmib_p2_p2Static_p2CnfRcvCrcError, | ||
856 | F_AP | F_STA | F_READ | F_WRITE, | ||
857 | HFA384x_RID_CNFRCVCRCERROR, 0, 0, | ||
858 | prism2mib_uint32 }, | ||
859 | { DIDmib_p2_p2Static_p2CnfAltRetryCount, | ||
860 | F_AP | F_STA | F_READ | F_WRITE, | ||
861 | HFA384x_RID_CNFALTRETRYCNT, 0, 0, | ||
862 | prism2mib_uint32 }, | ||
863 | { DIDmib_p2_p2Static_p2CnfBeaconInterval, | ||
864 | F_AP | F_READ | F_WRITE, | ||
865 | HFA384x_RID_CNFAPBCNINT, 0, 0, | ||
866 | prism2mib_uint32 }, | ||
867 | { DIDmib_p2_p2Static_p2CnfMediumOccupancyLimit, | ||
868 | F_AP | F_READ | F_WRITE, | ||
869 | HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 0, | ||
870 | prism2mib_uint32offset }, | ||
871 | { DIDmib_p2_p2Static_p2CnfCFPPeriod, | ||
872 | F_AP | F_READ | F_WRITE, | ||
873 | HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 1, | ||
874 | prism2mib_uint32offset }, | ||
875 | { DIDmib_p2_p2Static_p2CnfCFPMaxDuration, | ||
876 | F_AP | F_READ | F_WRITE, | ||
877 | HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 2, | ||
878 | prism2mib_uint32offset }, | ||
879 | { DIDmib_p2_p2Static_p2CnfCFPFlags, | ||
880 | F_AP | F_READ | F_WRITE, | ||
881 | HFA384x_RID_CNFAPPCFINFO, HFA384x_RID_CNFAPPCFINFO_LEN, 3, | ||
882 | prism2mib_uint32offset }, | ||
883 | { DIDmib_p2_p2Static_p2CnfSTAPCFInfo, | ||
884 | F_STA | F_READ | F_WRITE, | ||
885 | HFA384x_RID_CNFSTAPCFINFO, 0, 0, | ||
886 | prism2mib_uint32 }, | ||
887 | { DIDmib_p2_p2Static_p2CnfPriorityQUsage, | ||
888 | F_AP | F_STA | F_READ | F_WRITE, | ||
889 | HFA384x_RID_CNFPRIORITYQUSAGE, HFA384x_RID_CNFPRIOQUSAGE_LEN, 0, | ||
890 | prism2mib_uint32array }, | ||
891 | { DIDmib_p2_p2Static_p2CnfTIMCtrl, | ||
892 | F_AP | F_STA | F_READ | F_WRITE, | ||
893 | HFA384x_RID_CNFTIMCTRL, 0, 0, | ||
894 | prism2mib_uint32 }, | ||
895 | { DIDmib_p2_p2Static_p2CnfThirty2Tally, | ||
896 | F_AP | F_STA | F_READ | F_WRITE, | ||
897 | HFA384x_RID_CNFTHIRTY2TALLY, 0, 0, | ||
898 | prism2mib_truth }, | ||
899 | { DIDmib_p2_p2Static_p2CnfEnhSecurity, | ||
900 | F_AP | F_READ | F_WRITE, | ||
901 | HFA384x_RID_CNFENHSECURITY, 0, 0, | ||
902 | prism2mib_uint32 }, | ||
903 | { DIDmib_p2_p2Static_p2CnfShortPreamble, | ||
904 | F_AP | F_STA | F_READ | F_WRITE, | ||
905 | HFA384x_RID_CNFSHORTPREAMBLE, 0, 0, | ||
906 | prism2mib_preamble }, | ||
907 | { DIDmib_p2_p2Static_p2CnfExcludeLongPreamble, | ||
908 | F_AP | F_READ | F_WRITE, | ||
909 | HFA384x_RID_CNFEXCLONGPREAMBLE, 0, 0, | ||
910 | prism2mib_truth }, | ||
911 | { DIDmib_p2_p2Static_p2CnfAuthenticationRspTO, | ||
912 | F_STA | F_READ | F_WRITE, | ||
913 | HFA384x_RID_CNFAUTHRSPTIMEOUT, 0, 0, | ||
914 | prism2mib_uint32 }, | ||
915 | { DIDmib_p2_p2Static_p2CnfBasicRates, | ||
916 | F_AP | F_STA | F_READ | F_WRITE, | ||
917 | HFA384x_RID_CNFBASICRATES, 0, 0, | ||
918 | prism2mib_uint32 }, | ||
919 | { DIDmib_p2_p2Static_p2CnfSupportedRates, | ||
920 | F_AP | F_STA | F_READ | F_WRITE, | ||
921 | HFA384x_RID_CNFSUPPRATES, 0, 0, | ||
922 | prism2mib_uint32 }, | ||
923 | |||
924 | /* p2Dynamic MIB's */ | ||
925 | |||
926 | { DIDmib_p2_p2Dynamic_p2CreateIBSS, | ||
927 | F_STA | F_READ | F_WRITE, | ||
928 | HFA384x_RID_CREATEIBSS, 0, 0, | ||
929 | prism2mib_truth }, | ||
930 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold, | ||
931 | F_STA | F_READ | F_WRITE, | ||
932 | HFA384x_RID_FRAGTHRESH, 0, 0, | ||
933 | prism2mib_fragmentationthreshold }, | ||
934 | { DIDmib_p2_p2Dynamic_p2RTSThreshold, | ||
935 | F_STA | F_READ | F_WRITE, | ||
936 | HFA384x_RID_RTSTHRESH, 0, 0, | ||
937 | prism2mib_uint32 }, | ||
938 | { DIDmib_p2_p2Dynamic_p2TxRateControl, | ||
939 | F_STA | F_READ | F_WRITE, | ||
940 | HFA384x_RID_TXRATECNTL, 0, 0, | ||
941 | prism2mib_uint32 }, | ||
942 | { DIDmib_p2_p2Dynamic_p2PromiscuousMode, | ||
943 | F_STA | F_READ | F_WRITE, | ||
944 | HFA384x_RID_PROMISCMODE, 0, 0, | ||
945 | prism2mib_truth }, | ||
946 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold0, | ||
947 | F_AP | F_READ | F_WRITE, | ||
948 | HFA384x_RID_FRAGTHRESH0, 0, 0, | ||
949 | prism2mib_fragmentationthreshold }, | ||
950 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold1, | ||
951 | F_AP | F_READ | F_WRITE, | ||
952 | HFA384x_RID_FRAGTHRESH1, 0, 0, | ||
953 | prism2mib_fragmentationthreshold }, | ||
954 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold2, | ||
955 | F_AP | F_READ | F_WRITE, | ||
956 | HFA384x_RID_FRAGTHRESH2, 0, 0, | ||
957 | prism2mib_fragmentationthreshold }, | ||
958 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold3, | ||
959 | F_AP | F_READ | F_WRITE, | ||
960 | HFA384x_RID_FRAGTHRESH3, 0, 0, | ||
961 | prism2mib_fragmentationthreshold }, | ||
962 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold4, | ||
963 | F_AP | F_READ | F_WRITE, | ||
964 | HFA384x_RID_FRAGTHRESH4, 0, 0, | ||
965 | prism2mib_fragmentationthreshold }, | ||
966 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold5, | ||
967 | F_AP | F_READ | F_WRITE, | ||
968 | HFA384x_RID_FRAGTHRESH5, 0, 0, | ||
969 | prism2mib_fragmentationthreshold }, | ||
970 | { DIDmib_p2_p2Dynamic_p2FragmentationThreshold6, | ||
971 | F_AP | F_READ | F_WRITE, | ||
972 | HFA384x_RID_FRAGTHRESH6, 0, 0, | ||
973 | prism2mib_fragmentationthreshold }, | ||
974 | { DIDmib_p2_p2Dynamic_p2RTSThreshold0, | ||
975 | F_AP | F_READ | F_WRITE, | ||
976 | HFA384x_RID_RTSTHRESH0, 0, 0, | ||
977 | prism2mib_uint32 }, | ||
978 | { DIDmib_p2_p2Dynamic_p2RTSThreshold1, | ||
979 | F_AP | F_READ | F_WRITE, | ||
980 | HFA384x_RID_RTSTHRESH1, 0, 0, | ||
981 | prism2mib_uint32 }, | ||
982 | { DIDmib_p2_p2Dynamic_p2RTSThreshold2, | ||
983 | F_AP | F_READ | F_WRITE, | ||
984 | HFA384x_RID_RTSTHRESH2, 0, 0, | ||
985 | prism2mib_uint32 }, | ||
986 | { DIDmib_p2_p2Dynamic_p2RTSThreshold3, | ||
987 | F_AP | F_READ | F_WRITE, | ||
988 | HFA384x_RID_RTSTHRESH3, 0, 0, | ||
989 | prism2mib_uint32 }, | ||
990 | { DIDmib_p2_p2Dynamic_p2RTSThreshold4, | ||
991 | F_AP | F_READ | F_WRITE, | ||
992 | HFA384x_RID_RTSTHRESH4, 0, 0, | ||
993 | prism2mib_uint32 }, | ||
994 | { DIDmib_p2_p2Dynamic_p2RTSThreshold5, | ||
995 | F_AP | F_READ | F_WRITE, | ||
996 | HFA384x_RID_RTSTHRESH5, 0, 0, | ||
997 | prism2mib_uint32 }, | ||
998 | { DIDmib_p2_p2Dynamic_p2RTSThreshold6, | ||
999 | F_AP | F_READ | F_WRITE, | ||
1000 | HFA384x_RID_RTSTHRESH6, 0, 0, | ||
1001 | prism2mib_uint32 }, | ||
1002 | { DIDmib_p2_p2Dynamic_p2TxRateControl0, | ||
1003 | F_AP | F_READ | F_WRITE, | ||
1004 | HFA384x_RID_TXRATECNTL0, 0, 0, | ||
1005 | prism2mib_uint32 }, | ||
1006 | { DIDmib_p2_p2Dynamic_p2TxRateControl1, | ||
1007 | F_AP | F_READ | F_WRITE, | ||
1008 | HFA384x_RID_TXRATECNTL1, 0, 0, | ||
1009 | prism2mib_uint32 }, | ||
1010 | { DIDmib_p2_p2Dynamic_p2TxRateControl2, | ||
1011 | F_AP | F_READ | F_WRITE, | ||
1012 | HFA384x_RID_TXRATECNTL2, 0, 0, | ||
1013 | prism2mib_uint32 }, | ||
1014 | { DIDmib_p2_p2Dynamic_p2TxRateControl3, | ||
1015 | F_AP | F_READ | F_WRITE, | ||
1016 | HFA384x_RID_TXRATECNTL3, 0, 0, | ||
1017 | prism2mib_uint32 }, | ||
1018 | { DIDmib_p2_p2Dynamic_p2TxRateControl4, | ||
1019 | F_AP | F_READ | F_WRITE, | ||
1020 | HFA384x_RID_TXRATECNTL4, 0, 0, | ||
1021 | prism2mib_uint32 }, | ||
1022 | { DIDmib_p2_p2Dynamic_p2TxRateControl5, | ||
1023 | F_AP | F_READ | F_WRITE, | ||
1024 | HFA384x_RID_TXRATECNTL5, 0, 0, | ||
1025 | prism2mib_uint32 }, | ||
1026 | { DIDmib_p2_p2Dynamic_p2TxRateControl6, | ||
1027 | F_AP | F_READ | F_WRITE, | ||
1028 | HFA384x_RID_TXRATECNTL6, 0, 0, | ||
1029 | prism2mib_uint32 }, | ||
1030 | |||
1031 | /* p2Behavior MIB's */ | ||
1032 | |||
1033 | { DIDmib_p2_p2Behavior_p2TickTime, | ||
1034 | F_AP | F_STA | F_READ | F_WRITE, | ||
1035 | HFA384x_RID_ITICKTIME, 0, 0, | ||
1036 | prism2mib_uint32 }, | ||
1037 | |||
1038 | /* p2NIC MIB's */ | ||
1039 | |||
1040 | { DIDmib_p2_p2NIC_p2MaxLoadTime, | ||
1041 | F_AP | F_STA | F_READ, | ||
1042 | HFA384x_RID_MAXLOADTIME, 0, 0, | ||
1043 | prism2mib_uint32 }, | ||
1044 | { DIDmib_p2_p2NIC_p2DLBufferPage, | ||
1045 | F_AP | F_STA | F_READ, | ||
1046 | HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 0, | ||
1047 | prism2mib_uint32offset }, | ||
1048 | { DIDmib_p2_p2NIC_p2DLBufferOffset, | ||
1049 | F_AP | F_STA | F_READ, | ||
1050 | HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 1, | ||
1051 | prism2mib_uint32offset }, | ||
1052 | { DIDmib_p2_p2NIC_p2DLBufferLength, | ||
1053 | F_AP | F_STA | F_READ, | ||
1054 | HFA384x_RID_DOWNLOADBUFFER, HFA384x_RID_DOWNLOADBUFFER_LEN, 2, | ||
1055 | prism2mib_uint32offset }, | ||
1056 | { DIDmib_p2_p2NIC_p2PRIIdentity, | ||
1057 | F_AP | F_STA | F_READ, | ||
1058 | HFA384x_RID_PRIIDENTITY, HFA384x_RID_PRIIDENTITY_LEN, 0, | ||
1059 | prism2mib_uint32array }, | ||
1060 | { DIDmib_p2_p2NIC_p2PRISupRange, | ||
1061 | F_AP | F_STA | F_READ, | ||
1062 | HFA384x_RID_PRISUPRANGE, HFA384x_RID_PRISUPRANGE_LEN, 0, | ||
1063 | prism2mib_uint32array }, | ||
1064 | { DIDmib_p2_p2NIC_p2CFIActRanges, | ||
1065 | F_AP | F_STA | F_READ, | ||
1066 | HFA384x_RID_PRI_CFIACTRANGES, HFA384x_RID_CFIACTRANGES_LEN, 0, | ||
1067 | prism2mib_uint32array }, | ||
1068 | { DIDmib_p2_p2NIC_p2BuildSequence, | ||
1069 | F_AP | F_STA | F_READ, | ||
1070 | HFA384x_RID_BUILDSEQ, HFA384x_RID_BUILDSEQ_LEN, 0, | ||
1071 | prism2mib_uint32array }, | ||
1072 | { DIDmib_p2_p2NIC_p2PrimaryFWID, | ||
1073 | F_AP | F_STA | F_READ, | ||
1074 | 0, 0, 0, | ||
1075 | prism2mib_fwid }, | ||
1076 | { DIDmib_p2_p2NIC_p2SecondaryFWID, | ||
1077 | F_AP | F_STA | F_READ, | ||
1078 | 0, 0, 0, | ||
1079 | prism2mib_fwid }, | ||
1080 | { DIDmib_p2_p2NIC_p2TertiaryFWID, | ||
1081 | F_AP | F_READ, | ||
1082 | 0, 0, 0, | ||
1083 | prism2mib_fwid }, | ||
1084 | { DIDmib_p2_p2NIC_p2NICSerialNumber, | ||
1085 | F_AP | F_STA | F_READ, | ||
1086 | HFA384x_RID_NICSERIALNUMBER, HFA384x_RID_NICSERIALNUMBER_LEN, 0, | ||
1087 | prism2mib_bytearea2pstr }, | ||
1088 | { DIDmib_p2_p2NIC_p2NICIdentity, | ||
1089 | F_AP | F_STA | F_READ, | ||
1090 | HFA384x_RID_NICIDENTITY, HFA384x_RID_NICIDENTITY_LEN, 0, | ||
1091 | prism2mib_uint32array }, | ||
1092 | { DIDmib_p2_p2NIC_p2MFISupRange, | ||
1093 | F_AP | F_STA | F_READ, | ||
1094 | HFA384x_RID_MFISUPRANGE, HFA384x_RID_MFISUPRANGE_LEN, 0, | ||
1095 | prism2mib_uint32array }, | ||
1096 | { DIDmib_p2_p2NIC_p2CFISupRange, | ||
1097 | F_AP | F_STA | F_READ, | ||
1098 | HFA384x_RID_CFISUPRANGE, HFA384x_RID_CFISUPRANGE_LEN, 0, | ||
1099 | prism2mib_uint32array }, | ||
1100 | { DIDmib_p2_p2NIC_p2ChannelList, | ||
1101 | F_AP | F_STA | F_READ, | ||
1102 | HFA384x_RID_CHANNELLIST, 0, 0, | ||
1103 | prism2mib_uint32 }, | ||
1104 | { DIDmib_p2_p2NIC_p2RegulatoryDomains, | ||
1105 | F_AP | F_STA | F_READ, | ||
1106 | HFA384x_RID_REGULATORYDOMAINS, HFA384x_RID_REGULATORYDOMAINS_LEN, 0, | ||
1107 | prism2mib_regulatorydomains }, | ||
1108 | { DIDmib_p2_p2NIC_p2TempType, | ||
1109 | F_AP | F_STA | F_READ, | ||
1110 | HFA384x_RID_TEMPTYPE, 0, 0, | ||
1111 | prism2mib_uint32 }, | ||
1112 | { DIDmib_p2_p2NIC_p2STAIdentity, | ||
1113 | F_AP | F_STA | F_READ, | ||
1114 | HFA384x_RID_STAIDENTITY, HFA384x_RID_STAIDENTITY_LEN, 0, | ||
1115 | prism2mib_uint32array }, | ||
1116 | { DIDmib_p2_p2NIC_p2STASupRange, | ||
1117 | F_AP | F_STA | F_READ, | ||
1118 | HFA384x_RID_STASUPRANGE, HFA384x_RID_STASUPRANGE_LEN, 0, | ||
1119 | prism2mib_uint32array }, | ||
1120 | { DIDmib_p2_p2NIC_p2MFIActRanges, | ||
1121 | F_AP | F_STA | F_READ, | ||
1122 | HFA384x_RID_STA_MFIACTRANGES, HFA384x_RID_MFIACTRANGES_LEN, 0, | ||
1123 | prism2mib_uint32array }, | ||
1124 | { DIDmib_p2_p2NIC_p2STACFIActRanges, | ||
1125 | F_AP | F_STA | F_READ, | ||
1126 | HFA384x_RID_STA_CFIACTRANGES, HFA384x_RID_CFIACTRANGES2_LEN, 0, | ||
1127 | prism2mib_uint32array }, | ||
1128 | |||
1129 | /* p2MAC MIB's */ | ||
1130 | |||
1131 | { DIDmib_p2_p2MAC_p2PortStatus, | ||
1132 | F_STA | F_READ, | ||
1133 | HFA384x_RID_PORTSTATUS, 0, 0, | ||
1134 | prism2mib_uint32 }, | ||
1135 | { DIDmib_p2_p2MAC_p2CurrentSSID, | ||
1136 | F_STA | F_READ, | ||
1137 | HFA384x_RID_CURRENTSSID, HFA384x_RID_CURRENTSSID_LEN, 0, | ||
1138 | prism2mib_bytestr2pstr }, | ||
1139 | { DIDmib_p2_p2MAC_p2CurrentBSSID, | ||
1140 | F_STA | F_READ, | ||
1141 | HFA384x_RID_CURRENTBSSID, HFA384x_RID_CURRENTBSSID_LEN, 0, | ||
1142 | prism2mib_bytearea2pstr }, | ||
1143 | { DIDmib_p2_p2MAC_p2CommsQuality, | ||
1144 | F_STA | F_READ, | ||
1145 | HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0, | ||
1146 | prism2mib_uint32array }, | ||
1147 | { DIDmib_p2_p2MAC_p2CommsQualityCQ, | ||
1148 | F_STA | F_READ, | ||
1149 | HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0, | ||
1150 | prism2mib_uint32offset }, | ||
1151 | { DIDmib_p2_p2MAC_p2CommsQualityASL, | ||
1152 | F_STA | F_READ, | ||
1153 | HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1, | ||
1154 | prism2mib_uint32offset }, | ||
1155 | { DIDmib_p2_p2MAC_p2CommsQualityANL, | ||
1156 | F_STA | F_READ, | ||
1157 | HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2, | ||
1158 | prism2mib_uint32offset }, | ||
1159 | { DIDmib_p2_p2MAC_p2dbmCommsQuality, | ||
1160 | F_STA | F_READ, | ||
1161 | HFA384x_RID_DBMCOMMSQUALITY, HFA384x_RID_DBMCOMMSQUALITY_LEN, 0, | ||
1162 | prism2mib_uint32array }, | ||
1163 | { DIDmib_p2_p2MAC_p2dbmCommsQualityCQ, | ||
1164 | F_STA | F_READ, | ||
1165 | HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 0, | ||
1166 | prism2mib_uint32offset }, | ||
1167 | { DIDmib_p2_p2MAC_p2dbmCommsQualityASL, | ||
1168 | F_STA | F_READ, | ||
1169 | HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 1, | ||
1170 | prism2mib_uint32offset }, | ||
1171 | { DIDmib_p2_p2MAC_p2dbmCommsQualityANL, | ||
1172 | F_STA | F_READ, | ||
1173 | HFA384x_RID_COMMSQUALITY, HFA384x_RID_COMMSQUALITY_LEN, 2, | ||
1174 | prism2mib_uint32offset }, | ||
1175 | { DIDmib_p2_p2MAC_p2CurrentTxRate, | ||
1176 | F_STA | F_READ, | ||
1177 | HFA384x_RID_CURRENTTXRATE, 0, 0, | ||
1178 | prism2mib_uint32 }, | ||
1179 | { DIDmib_p2_p2MAC_p2CurrentBeaconInterval, | ||
1180 | F_AP | F_STA | F_READ, | ||
1181 | HFA384x_RID_CURRENTBCNINT, 0, 0, | ||
1182 | prism2mib_uint32 }, | ||
1183 | { DIDmib_p2_p2MAC_p2StaCurrentScaleThresholds, | ||
1184 | F_STA | F_READ, | ||
1185 | HFA384x_RID_CURRENTSCALETHRESH, HFA384x_RID_STACURSCALETHRESH_LEN, 0, | ||
1186 | prism2mib_uint32array }, | ||
1187 | { DIDmib_p2_p2MAC_p2APCurrentScaleThresholds, | ||
1188 | F_AP | F_READ, | ||
1189 | HFA384x_RID_CURRENTSCALETHRESH, HFA384x_RID_APCURSCALETHRESH_LEN, 0, | ||
1190 | prism2mib_uint32array }, | ||
1191 | { DIDmib_p2_p2MAC_p2ProtocolRspTime, | ||
1192 | F_AP | F_STA | F_READ, | ||
1193 | HFA384x_RID_PROTOCOLRSPTIME, 0, 0, | ||
1194 | prism2mib_uint32 }, | ||
1195 | { DIDmib_p2_p2MAC_p2ShortRetryLimit, | ||
1196 | F_AP | F_STA | F_READ, | ||
1197 | HFA384x_RID_SHORTRETRYLIMIT, 0, 0, | ||
1198 | prism2mib_uint32 }, | ||
1199 | { DIDmib_p2_p2MAC_p2LongRetryLimit, | ||
1200 | F_AP | F_STA | F_READ, | ||
1201 | HFA384x_RID_LONGRETRYLIMIT, 0, 0, | ||
1202 | prism2mib_uint32 }, | ||
1203 | { DIDmib_p2_p2MAC_p2MaxTransmitLifetime, | ||
1204 | F_AP | F_STA | F_READ, | ||
1205 | HFA384x_RID_MAXTXLIFETIME, 0, 0, | ||
1206 | prism2mib_uint32 }, | ||
1207 | { DIDmib_p2_p2MAC_p2MaxReceiveLifetime, | ||
1208 | F_AP | F_STA | F_READ, | ||
1209 | HFA384x_RID_MAXRXLIFETIME, 0, 0, | ||
1210 | prism2mib_uint32 }, | ||
1211 | { DIDmib_p2_p2MAC_p2CFPollable, | ||
1212 | F_STA | F_READ, | ||
1213 | HFA384x_RID_CFPOLLABLE, 0, 0, | ||
1214 | prism2mib_uint32 }, | ||
1215 | { DIDmib_p2_p2MAC_p2AuthenticationAlgorithms, | ||
1216 | F_AP | F_STA | F_READ, | ||
1217 | HFA384x_RID_AUTHALGORITHMS, HFA384x_RID_AUTHALGORITHMS_LEN, 0, | ||
1218 | prism2mib_uint32array }, | ||
1219 | { DIDmib_p2_p2MAC_p2PrivacyOptionImplemented, | ||
1220 | F_AP | F_STA | F_READ, | ||
1221 | HFA384x_RID_PRIVACYOPTIMP, 0, 0, | ||
1222 | prism2mib_uint32 }, | ||
1223 | { DIDmib_p2_p2MAC_p2CurrentTxRate1, | ||
1224 | F_AP | F_READ, | ||
1225 | HFA384x_RID_CURRENTTXRATE1, 0, 0, | ||
1226 | prism2mib_uint32 }, | ||
1227 | { DIDmib_p2_p2MAC_p2CurrentTxRate2, | ||
1228 | F_AP | F_READ, | ||
1229 | HFA384x_RID_CURRENTTXRATE2, 0, 0, | ||
1230 | prism2mib_uint32 }, | ||
1231 | { DIDmib_p2_p2MAC_p2CurrentTxRate3, | ||
1232 | F_AP | F_READ, | ||
1233 | HFA384x_RID_CURRENTTXRATE3, 0, 0, | ||
1234 | prism2mib_uint32 }, | ||
1235 | { DIDmib_p2_p2MAC_p2CurrentTxRate4, | ||
1236 | F_AP | F_READ, | ||
1237 | HFA384x_RID_CURRENTTXRATE4, 0, 0, | ||
1238 | prism2mib_uint32 }, | ||
1239 | { DIDmib_p2_p2MAC_p2CurrentTxRate5, | ||
1240 | F_AP | F_READ, | ||
1241 | HFA384x_RID_CURRENTTXRATE5, 0, 0, | ||
1242 | prism2mib_uint32 }, | ||
1243 | { DIDmib_p2_p2MAC_p2CurrentTxRate6, | ||
1244 | F_AP | F_READ, | ||
1245 | HFA384x_RID_CURRENTTXRATE6, 0, 0, | ||
1246 | prism2mib_uint32 }, | ||
1247 | { DIDmib_p2_p2MAC_p2OwnMACAddress, | ||
1248 | F_AP | F_READ, | ||
1249 | HFA384x_RID_OWNMACADDRESS, HFA384x_RID_OWNMACADDRESS_LEN, 0, | ||
1250 | prism2mib_bytearea2pstr }, | ||
1251 | |||
1252 | /* p2Modem MIB's */ | ||
1253 | |||
1254 | { DIDmib_p2_p2Modem_p2PHYType, | ||
1255 | F_AP | F_STA | F_READ, | ||
1256 | HFA384x_RID_PHYTYPE, 0, 0, | ||
1257 | prism2mib_uint32 }, | ||
1258 | { DIDmib_p2_p2Modem_p2CurrentChannel, | ||
1259 | F_AP | F_STA | F_READ, | ||
1260 | HFA384x_RID_CURRENTCHANNEL, 0, 0, | ||
1261 | prism2mib_uint32 }, | ||
1262 | { DIDmib_p2_p2Modem_p2CurrentPowerState, | ||
1263 | F_AP | F_STA | F_READ, | ||
1264 | HFA384x_RID_CURRENTPOWERSTATE, 0, 0, | ||
1265 | prism2mib_uint32 }, | ||
1266 | { DIDmib_p2_p2Modem_p2CCAMode, | ||
1267 | F_AP | F_STA | F_READ, | ||
1268 | HFA384x_RID_CCAMODE, 0, 0, | ||
1269 | prism2mib_uint32 }, | ||
1270 | { DIDmib_p2_p2Modem_p2TxPowerMax, | ||
1271 | F_AP | F_STA | F_READ | F_WRITE, | ||
1272 | HFA384x_RID_TXPOWERMAX, 0, 0, | ||
1273 | prism2mib_uint32 }, | ||
1274 | { DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel, | ||
1275 | F_AP | F_STA | F_READ | F_WRITE, | ||
1276 | HFA384x_RID_TXPOWERMAX, 0, 0, | ||
1277 | prism2mib_uint32 }, | ||
1278 | { DIDmib_p2_p2Modem_p2SupportedDataRates, | ||
1279 | F_AP | F_STA | F_READ, | ||
1280 | HFA384x_RID_SUPPORTEDDATARATES, HFA384x_RID_SUPPORTEDDATARATES_LEN, 0, | ||
1281 | prism2mib_bytestr2pstr }, | ||
1282 | |||
1283 | /* And finally, lnx mibs */ | ||
1284 | { DIDmib_lnx_lnxConfigTable_lnxRSNAIE, | ||
1285 | F_STA | F_READ | F_WRITE, | ||
1286 | HFA384x_RID_CNFWPADATA, 0, 0, | ||
1287 | prism2mib_priv }, | ||
1288 | { 0, 0, 0, 0, 0, NULL}}; | ||
1289 | |||
1290 | /*---------------------------------------------------------------- | ||
1291 | These MIB's are not supported at this time: | ||
1292 | |||
1293 | DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityPresent | ||
1294 | DIDmib_dot11phy_dot11PhyOperationTable_dot11ChannelAgilityEnabled | ||
1295 | DIDmib_dot11phy_dot11PhyDSSSTable_dot11PBCCOptionImplemented | ||
1296 | DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportIndex | ||
1297 | DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxIndex | ||
1298 | DIDmib_dot11phy_dot11SupportedDataRatesTxTable_dot11SupportedDataRatesTxValue | ||
1299 | DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxIndex | ||
1300 | DIDmib_dot11phy_dot11SupportedDataRatesRxTable_dot11SupportedDataRatesRxValue | ||
1301 | |||
1302 | DIDmib_dot11phy_dot11RegDomainsSupportedTable_dot11RegDomainsSupportValue | ||
1303 | TODO: need to investigate why wlan has this as enumerated and Prism2 has this | ||
1304 | as btye str. | ||
1305 | |||
1306 | DIDmib_dot11phy_dot11PhyDSSSTable_dot11ShortPreambleOptionImplemented | ||
1307 | TODO: Find out the firmware version number(s) for identifying | ||
1308 | whether the firmware is capable of short preamble. TRUE or FALSE | ||
1309 | will be returned based on the version of the firmware. | ||
1310 | |||
1311 | WEP Key mappings aren't supported in the f/w. | ||
1312 | DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingIndex | ||
1313 | DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingAddress | ||
1314 | DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingWEPOn | ||
1315 | DIDmib_dot11smt_dot11WEPKeyMappingsTable_dot11WEPKeyMappingValue | ||
1316 | DIDmib_dot11smt_dot11PrivacyTable_dot11WEPKeyMappingLength | ||
1317 | |||
1318 | TODO: implement counters. | ||
1319 | DIDmib_dot11smt_dot11PrivacyTable_dot11WEPICVErrorCount | ||
1320 | DIDmib_dot11smt_dot11PrivacyTable_dot11WEPExcludedCount | ||
1321 | DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFragmentCount | ||
1322 | DIDmib_dot11mac_dot11CountersTable_dot11MulticastTransmittedFrameCount | ||
1323 | DIDmib_dot11mac_dot11CountersTable_dot11FailedCount | ||
1324 | DIDmib_dot11mac_dot11CountersTable_dot11RetryCount | ||
1325 | DIDmib_dot11mac_dot11CountersTable_dot11MultipleRetryCount | ||
1326 | DIDmib_dot11mac_dot11CountersTable_dot11FrameDuplicateCount | ||
1327 | DIDmib_dot11mac_dot11CountersTable_dot11RTSSuccessCount | ||
1328 | DIDmib_dot11mac_dot11CountersTable_dot11RTSFailureCount | ||
1329 | DIDmib_dot11mac_dot11CountersTable_dot11ACKFailureCount | ||
1330 | DIDmib_dot11mac_dot11CountersTable_dot11ReceivedFragmentCount | ||
1331 | DIDmib_dot11mac_dot11CountersTable_dot11MulticastReceivedFrameCount | ||
1332 | DIDmib_dot11mac_dot11CountersTable_dot11FCSErrorCount | ||
1333 | DIDmib_dot11mac_dot11CountersTable_dot11TransmittedFrameCount | ||
1334 | DIDmib_dot11mac_dot11CountersTable_dot11WEPUndecryptableCount | ||
1335 | |||
1336 | TODO: implement sane values for these. | ||
1337 | DIDmib_dot11mac_dot11OperationTable_dot11ManufacturerID | ||
1338 | DIDmib_dot11mac_dot11OperationTable_dot11ProductID | ||
1339 | |||
1340 | Not too worried about these at the moment. | ||
1341 | DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentTxAntenna | ||
1342 | DIDmib_dot11phy_dot11PhyAntennaTable_dot11DiversitySupport | ||
1343 | DIDmib_dot11phy_dot11PhyAntennaTable_dot11CurrentRxAntenna | ||
1344 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11NumberSupportedPowerLevels | ||
1345 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel1 | ||
1346 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel2 | ||
1347 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel3 | ||
1348 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel4 | ||
1349 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel5 | ||
1350 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel6 | ||
1351 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel7 | ||
1352 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11TxPowerLevel8 | ||
1353 | DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel | ||
1354 | |||
1355 | Ummm, FH and IR don't apply | ||
1356 | DIDmib_dot11phy_dot11PhyFHSSTable_dot11HopTime | ||
1357 | DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentChannelNumber | ||
1358 | DIDmib_dot11phy_dot11PhyFHSSTable_dot11MaxDwellTime | ||
1359 | DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentDwellTime | ||
1360 | DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentSet | ||
1361 | DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentPattern | ||
1362 | DIDmib_dot11phy_dot11PhyFHSSTable_dot11CurrentIndex | ||
1363 | DIDmib_dot11phy_dot11PhyDSSSTable_dot11CCAModeSupported | ||
1364 | DIDmib_dot11phy_dot11PhyDSSSTable_dot11EDThreshold | ||
1365 | DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMax | ||
1366 | DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMax | ||
1367 | DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogTimerMin | ||
1368 | DIDmib_dot11phy_dot11PhyIRTable_dot11CCAWatchdogCountMin | ||
1369 | |||
1370 | We just don't have enough antennas right now to worry about this. | ||
1371 | DIDmib_dot11phy_dot11AntennasListTable_dot11AntennaListIndex | ||
1372 | DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedTxAntenna | ||
1373 | DIDmib_dot11phy_dot11AntennasListTable_dot11SupportedRxAntenna | ||
1374 | DIDmib_dot11phy_dot11AntennasListTable_dot11DiversitySelectionRx | ||
1375 | |||
1376 | ------------------------------------------------------------------*/ | ||
1377 | |||
1378 | /*================================================================*/ | ||
1379 | /* Function Definitions */ | ||
1380 | |||
1381 | /*---------------------------------------------------------------- | ||
1382 | * prism2mgmt_mibset_mibget | ||
1383 | * | ||
1384 | * Set the value of a mib item. | ||
1385 | * | ||
1386 | * Arguments: | ||
1387 | * wlandev wlan device structure | ||
1388 | * msgp ptr to msg buffer | ||
1389 | * | ||
1390 | * Returns: | ||
1391 | * 0 success and done | ||
1392 | * <0 success, but we're waiting for something to finish. | ||
1393 | * >0 an error occurred while handling the message. | ||
1394 | * Side effects: | ||
1395 | * | ||
1396 | * Call context: | ||
1397 | * process thread (usually) | ||
1398 | * interrupt | ||
1399 | ----------------------------------------------------------------*/ | ||
1400 | |||
1401 | int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp) | ||
1402 | { | ||
1403 | hfa384x_t *hw = wlandev->priv; | ||
1404 | int result, isget; | ||
1405 | mibrec_t *mib; | ||
1406 | UINT16 which; | ||
1407 | |||
1408 | p80211msg_dot11req_mibset_t *msg = msgp; | ||
1409 | p80211itemd_t *mibitem; | ||
1410 | |||
1411 | DBFENTER; | ||
1412 | |||
1413 | msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; | ||
1414 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
1415 | |||
1416 | /* | ||
1417 | ** Determine if this is an Access Point or a station. | ||
1418 | */ | ||
1419 | |||
1420 | which = hw->ap ? F_AP : F_STA; | ||
1421 | |||
1422 | /* | ||
1423 | ** Find the MIB in the MIB table. Note that a MIB may be in the | ||
1424 | ** table twice...once for an AP and once for a station. Make sure | ||
1425 | ** to get the correct one. Note that DID=0 marks the end of the | ||
1426 | ** MIB table. | ||
1427 | */ | ||
1428 | |||
1429 | mibitem = (p80211itemd_t *) msg->mibattribute.data; | ||
1430 | |||
1431 | for (mib = mibtab; mib->did != 0; mib++) | ||
1432 | if (mib->did == mibitem->did && (mib->flag & which)) | ||
1433 | break; | ||
1434 | |||
1435 | if (mib->did == 0) { | ||
1436 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
1437 | goto done; | ||
1438 | } | ||
1439 | |||
1440 | /* | ||
1441 | ** Determine if this is a "mibget" or a "mibset". If this is a | ||
1442 | ** "mibget", then make sure that the MIB may be read. Otherwise, | ||
1443 | ** this is a "mibset" so make make sure that the MIB may be written. | ||
1444 | */ | ||
1445 | |||
1446 | isget = (msg->msgcode == DIDmsg_dot11req_mibget); | ||
1447 | |||
1448 | if (isget) { | ||
1449 | if (!(mib->flag & F_READ)) { | ||
1450 | msg->resultcode.data = | ||
1451 | P80211ENUM_resultcode_cant_get_writeonly_mib; | ||
1452 | goto done; | ||
1453 | } | ||
1454 | } else { | ||
1455 | if (!(mib->flag & F_WRITE)) { | ||
1456 | msg->resultcode.data = | ||
1457 | P80211ENUM_resultcode_cant_set_readonly_mib; | ||
1458 | goto done; | ||
1459 | } | ||
1460 | } | ||
1461 | |||
1462 | /* | ||
1463 | ** Execute the MIB function. If things worked okay, then make | ||
1464 | ** sure that the MIB function also worked okay. If so, and this | ||
1465 | ** is a "mibget", then the status value must be set for both the | ||
1466 | ** "mibattribute" parameter and the mib item within the data | ||
1467 | ** portion of the "mibattribute". | ||
1468 | */ | ||
1469 | |||
1470 | result = mib->func(mib, isget, wlandev, hw, msg, | ||
1471 | (void *) mibitem->data); | ||
1472 | |||
1473 | if (msg->resultcode.data == P80211ENUM_resultcode_success) { | ||
1474 | if (result != 0) { | ||
1475 | WLAN_LOG_DEBUG(1, "get/set failure, result=%d\n", | ||
1476 | result); | ||
1477 | msg->resultcode.data = | ||
1478 | P80211ENUM_resultcode_implementation_failure; | ||
1479 | } else { | ||
1480 | if (isget) { | ||
1481 | msg->mibattribute.status = | ||
1482 | P80211ENUM_msgitem_status_data_ok; | ||
1483 | mibitem->status = | ||
1484 | P80211ENUM_msgitem_status_data_ok; | ||
1485 | } | ||
1486 | } | ||
1487 | } | ||
1488 | |||
1489 | done: | ||
1490 | DBFEXIT; | ||
1491 | |||
1492 | return(0); | ||
1493 | } | ||
1494 | |||
1495 | /*---------------------------------------------------------------- | ||
1496 | * prism2mib_bytestr2pstr | ||
1497 | * | ||
1498 | * Get/set pstr data to/from a byte string. | ||
1499 | * | ||
1500 | * MIB record parameters: | ||
1501 | * parm1 Prism2 RID value. | ||
1502 | * parm2 Number of bytes of RID data. | ||
1503 | * parm3 Not used. | ||
1504 | * | ||
1505 | * Arguments: | ||
1506 | * mib MIB record. | ||
1507 | * isget MIBGET/MIBSET flag. | ||
1508 | * wlandev wlan device structure. | ||
1509 | * priv "priv" structure. | ||
1510 | * hw "hw" structure. | ||
1511 | * msg Message structure. | ||
1512 | * data Data buffer. | ||
1513 | * | ||
1514 | * Returns: | ||
1515 | * 0 - Success. | ||
1516 | * ~0 - Error. | ||
1517 | * | ||
1518 | ----------------------------------------------------------------*/ | ||
1519 | |||
1520 | static int prism2mib_bytestr2pstr( | ||
1521 | mibrec_t *mib, | ||
1522 | int isget, | ||
1523 | wlandevice_t *wlandev, | ||
1524 | hfa384x_t *hw, | ||
1525 | p80211msg_dot11req_mibset_t *msg, | ||
1526 | void *data) | ||
1527 | { | ||
1528 | int result; | ||
1529 | p80211pstrd_t *pstr = (p80211pstrd_t*) data; | ||
1530 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1531 | hfa384x_bytestr_t *p2bytestr = (hfa384x_bytestr_t*) bytebuf; | ||
1532 | |||
1533 | DBFENTER; | ||
1534 | |||
1535 | if (isget) { | ||
1536 | result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2); | ||
1537 | prism2mgmt_bytestr2pstr(p2bytestr, pstr); | ||
1538 | } else { | ||
1539 | memset(bytebuf, 0, mib->parm2); | ||
1540 | prism2mgmt_pstr2bytestr(p2bytestr, pstr); | ||
1541 | result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2); | ||
1542 | } | ||
1543 | |||
1544 | DBFEXIT; | ||
1545 | return(result); | ||
1546 | } | ||
1547 | |||
1548 | /*---------------------------------------------------------------- | ||
1549 | * prism2mib_bytearea2pstr | ||
1550 | * | ||
1551 | * Get/set pstr data to/from a byte area. | ||
1552 | * | ||
1553 | * MIB record parameters: | ||
1554 | * parm1 Prism2 RID value. | ||
1555 | * parm2 Number of bytes of RID data. | ||
1556 | * parm3 Not used. | ||
1557 | * | ||
1558 | * Arguments: | ||
1559 | * mib MIB record. | ||
1560 | * isget MIBGET/MIBSET flag. | ||
1561 | * wlandev wlan device structure. | ||
1562 | * priv "priv" structure. | ||
1563 | * hw "hw" structure. | ||
1564 | * msg Message structure. | ||
1565 | * data Data buffer. | ||
1566 | * | ||
1567 | * Returns: | ||
1568 | * 0 - Success. | ||
1569 | * ~0 - Error. | ||
1570 | * | ||
1571 | ----------------------------------------------------------------*/ | ||
1572 | |||
1573 | static int prism2mib_bytearea2pstr( | ||
1574 | mibrec_t *mib, | ||
1575 | int isget, | ||
1576 | wlandevice_t *wlandev, | ||
1577 | hfa384x_t *hw, | ||
1578 | p80211msg_dot11req_mibset_t *msg, | ||
1579 | void *data) | ||
1580 | { | ||
1581 | int result; | ||
1582 | p80211pstrd_t *pstr = (p80211pstrd_t*) data; | ||
1583 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1584 | |||
1585 | DBFENTER; | ||
1586 | |||
1587 | if (isget) { | ||
1588 | result = hfa384x_drvr_getconfig(hw, mib->parm1, bytebuf, mib->parm2); | ||
1589 | prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2); | ||
1590 | } else { | ||
1591 | memset(bytebuf, 0, mib->parm2); | ||
1592 | prism2mgmt_pstr2bytearea(bytebuf, pstr); | ||
1593 | result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2); | ||
1594 | } | ||
1595 | |||
1596 | DBFEXIT; | ||
1597 | return(result); | ||
1598 | } | ||
1599 | |||
1600 | /*---------------------------------------------------------------- | ||
1601 | * prism2mib_uint32 | ||
1602 | * | ||
1603 | * Get/set uint32 data. | ||
1604 | * | ||
1605 | * MIB record parameters: | ||
1606 | * parm1 Prism2 RID value. | ||
1607 | * parm2 Not used. | ||
1608 | * parm3 Not used. | ||
1609 | * | ||
1610 | * Arguments: | ||
1611 | * mib MIB record. | ||
1612 | * isget MIBGET/MIBSET flag. | ||
1613 | * wlandev wlan device structure. | ||
1614 | * priv "priv" structure. | ||
1615 | * hw "hw" structure. | ||
1616 | * msg Message structure. | ||
1617 | * data Data buffer. | ||
1618 | * | ||
1619 | * Returns: | ||
1620 | * 0 - Success. | ||
1621 | * ~0 - Error. | ||
1622 | * | ||
1623 | ----------------------------------------------------------------*/ | ||
1624 | |||
1625 | static int prism2mib_uint32( | ||
1626 | mibrec_t *mib, | ||
1627 | int isget, | ||
1628 | wlandevice_t *wlandev, | ||
1629 | hfa384x_t *hw, | ||
1630 | p80211msg_dot11req_mibset_t *msg, | ||
1631 | void *data) | ||
1632 | { | ||
1633 | int result; | ||
1634 | UINT32 *uint32 = (UINT32*) data; | ||
1635 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1636 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
1637 | |||
1638 | DBFENTER; | ||
1639 | |||
1640 | if (isget) { | ||
1641 | result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); | ||
1642 | *uint32 = *wordbuf; | ||
1643 | /* [MSM] Removed, getconfig16 returns the value in host order. | ||
1644 | * prism2mgmt_prism2int2p80211int(wordbuf, uint32); | ||
1645 | */ | ||
1646 | } else { | ||
1647 | /* [MSM] Removed, setconfig16 expects host order. | ||
1648 | * prism2mgmt_p80211int2prism2int(wordbuf, uint32); | ||
1649 | */ | ||
1650 | *wordbuf = *uint32; | ||
1651 | result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); | ||
1652 | } | ||
1653 | |||
1654 | DBFEXIT; | ||
1655 | return(result); | ||
1656 | } | ||
1657 | |||
1658 | /*---------------------------------------------------------------- | ||
1659 | * prism2mib_uint32array | ||
1660 | * | ||
1661 | * Get/set an array of uint32 data. | ||
1662 | * | ||
1663 | * MIB record parameters: | ||
1664 | * parm1 Prism2 RID value. | ||
1665 | * parm2 Number of bytes of RID data. | ||
1666 | * parm3 Not used. | ||
1667 | * | ||
1668 | * Arguments: | ||
1669 | * mib MIB record. | ||
1670 | * isget MIBGET/MIBSET flag. | ||
1671 | * wlandev wlan device structure. | ||
1672 | * priv "priv" structure. | ||
1673 | * hw "hw" structure. | ||
1674 | * msg Message structure. | ||
1675 | * data Data buffer. | ||
1676 | * | ||
1677 | * Returns: | ||
1678 | * 0 - Success. | ||
1679 | * ~0 - Error. | ||
1680 | * | ||
1681 | ----------------------------------------------------------------*/ | ||
1682 | |||
1683 | static int prism2mib_uint32array( | ||
1684 | mibrec_t *mib, | ||
1685 | int isget, | ||
1686 | wlandevice_t *wlandev, | ||
1687 | hfa384x_t *hw, | ||
1688 | p80211msg_dot11req_mibset_t *msg, | ||
1689 | void *data) | ||
1690 | { | ||
1691 | int result; | ||
1692 | UINT32 *uint32 = (UINT32 *) data; | ||
1693 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1694 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
1695 | int i, cnt; | ||
1696 | |||
1697 | DBFENTER; | ||
1698 | |||
1699 | cnt = mib->parm2 / sizeof(UINT16); | ||
1700 | |||
1701 | if (isget) { | ||
1702 | result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2); | ||
1703 | for (i = 0; i < cnt; i++) | ||
1704 | prism2mgmt_prism2int2p80211int(wordbuf+i, uint32+i); | ||
1705 | } else { | ||
1706 | for (i = 0; i < cnt; i++) | ||
1707 | prism2mgmt_p80211int2prism2int(wordbuf+i, uint32+i); | ||
1708 | result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2); | ||
1709 | } | ||
1710 | |||
1711 | DBFEXIT; | ||
1712 | return(result); | ||
1713 | } | ||
1714 | |||
1715 | /*---------------------------------------------------------------- | ||
1716 | * prism2mib_uint32offset | ||
1717 | * | ||
1718 | * Get/set a single element in an array of uint32 data. | ||
1719 | * | ||
1720 | * MIB record parameters: | ||
1721 | * parm1 Prism2 RID value. | ||
1722 | * parm2 Number of bytes of RID data. | ||
1723 | * parm3 Element index. | ||
1724 | * | ||
1725 | * Arguments: | ||
1726 | * mib MIB record. | ||
1727 | * isget MIBGET/MIBSET flag. | ||
1728 | * wlandev wlan device structure. | ||
1729 | * priv "priv" structure. | ||
1730 | * hw "hw" structure. | ||
1731 | * msg Message structure. | ||
1732 | * data Data buffer. | ||
1733 | * | ||
1734 | * Returns: | ||
1735 | * 0 - Success. | ||
1736 | * ~0 - Error. | ||
1737 | * | ||
1738 | ----------------------------------------------------------------*/ | ||
1739 | |||
1740 | static int prism2mib_uint32offset( | ||
1741 | mibrec_t *mib, | ||
1742 | int isget, | ||
1743 | wlandevice_t *wlandev, | ||
1744 | hfa384x_t *hw, | ||
1745 | p80211msg_dot11req_mibset_t *msg, | ||
1746 | void *data) | ||
1747 | { | ||
1748 | int result; | ||
1749 | UINT32 *uint32 = (UINT32*) data; | ||
1750 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1751 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
1752 | UINT16 cnt; | ||
1753 | |||
1754 | DBFENTER; | ||
1755 | |||
1756 | cnt = mib->parm2 / sizeof(UINT16); | ||
1757 | |||
1758 | result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2); | ||
1759 | if (result == 0) { | ||
1760 | if (isget) { | ||
1761 | if (mib->parm3 < cnt) | ||
1762 | prism2mgmt_prism2int2p80211int(wordbuf+mib->parm3, uint32); | ||
1763 | else | ||
1764 | *uint32 = 0; | ||
1765 | } else { | ||
1766 | if (mib->parm3 < cnt) { | ||
1767 | prism2mgmt_p80211int2prism2int(wordbuf+mib->parm3, uint32); | ||
1768 | result = hfa384x_drvr_setconfig(hw, mib->parm1, wordbuf, mib->parm2); | ||
1769 | } | ||
1770 | } | ||
1771 | } | ||
1772 | |||
1773 | DBFEXIT; | ||
1774 | return(result); | ||
1775 | } | ||
1776 | |||
1777 | /*---------------------------------------------------------------- | ||
1778 | * prism2mib_truth | ||
1779 | * | ||
1780 | * Get/set truth data. | ||
1781 | * | ||
1782 | * MIB record parameters: | ||
1783 | * parm1 Prism2 RID value. | ||
1784 | * parm2 Not used. | ||
1785 | * parm3 Not used. | ||
1786 | * | ||
1787 | * Arguments: | ||
1788 | * mib MIB record. | ||
1789 | * isget MIBGET/MIBSET flag. | ||
1790 | * wlandev wlan device structure. | ||
1791 | * priv "priv" structure. | ||
1792 | * hw "hw" structure. | ||
1793 | * msg Message structure. | ||
1794 | * data Data buffer. | ||
1795 | * | ||
1796 | * Returns: | ||
1797 | * 0 - Success. | ||
1798 | * ~0 - Error. | ||
1799 | * | ||
1800 | ----------------------------------------------------------------*/ | ||
1801 | |||
1802 | static int prism2mib_truth( | ||
1803 | mibrec_t *mib, | ||
1804 | int isget, | ||
1805 | wlandevice_t *wlandev, | ||
1806 | hfa384x_t *hw, | ||
1807 | p80211msg_dot11req_mibset_t *msg, | ||
1808 | void *data) | ||
1809 | { | ||
1810 | int result; | ||
1811 | UINT32 *uint32 = (UINT32*) data; | ||
1812 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1813 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
1814 | |||
1815 | DBFENTER; | ||
1816 | |||
1817 | if (isget) { | ||
1818 | result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); | ||
1819 | *uint32 = (*wordbuf) ? | ||
1820 | P80211ENUM_truth_true : P80211ENUM_truth_false; | ||
1821 | } else { | ||
1822 | *wordbuf = ((*uint32) == P80211ENUM_truth_true) ? 1 : 0; | ||
1823 | result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); | ||
1824 | } | ||
1825 | |||
1826 | DBFEXIT; | ||
1827 | return(result); | ||
1828 | } | ||
1829 | |||
1830 | /*---------------------------------------------------------------- | ||
1831 | * prism2mib_flag | ||
1832 | * | ||
1833 | * Get/set a flag. | ||
1834 | * | ||
1835 | * MIB record parameters: | ||
1836 | * parm1 Prism2 RID value. | ||
1837 | * parm2 Bit to get/set. | ||
1838 | * parm3 Not used. | ||
1839 | * | ||
1840 | * Arguments: | ||
1841 | * mib MIB record. | ||
1842 | * isget MIBGET/MIBSET flag. | ||
1843 | * wlandev wlan device structure. | ||
1844 | * priv "priv" structure. | ||
1845 | * hw "hw" structure. | ||
1846 | * msg Message structure. | ||
1847 | * data Data buffer. | ||
1848 | * | ||
1849 | * Returns: | ||
1850 | * 0 - Success. | ||
1851 | * ~0 - Error. | ||
1852 | * | ||
1853 | ----------------------------------------------------------------*/ | ||
1854 | |||
1855 | static int prism2mib_flag( | ||
1856 | mibrec_t *mib, | ||
1857 | int isget, | ||
1858 | wlandevice_t *wlandev, | ||
1859 | hfa384x_t *hw, | ||
1860 | p80211msg_dot11req_mibset_t *msg, | ||
1861 | void *data) | ||
1862 | { | ||
1863 | int result; | ||
1864 | UINT32 *uint32 = (UINT32*) data; | ||
1865 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1866 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
1867 | UINT32 flags; | ||
1868 | |||
1869 | DBFENTER; | ||
1870 | |||
1871 | result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); | ||
1872 | if (result == 0) { | ||
1873 | /* [MSM] Removed, getconfig16 returns the value in host order. | ||
1874 | * prism2mgmt_prism2int2p80211int(wordbuf, &flags); | ||
1875 | */ | ||
1876 | flags = *wordbuf; | ||
1877 | if (isget) { | ||
1878 | *uint32 = (flags & mib->parm2) ? | ||
1879 | P80211ENUM_truth_true : P80211ENUM_truth_false; | ||
1880 | } else { | ||
1881 | if ((*uint32) == P80211ENUM_truth_true) | ||
1882 | flags |= mib->parm2; | ||
1883 | else | ||
1884 | flags &= ~mib->parm2; | ||
1885 | /* [MSM] Removed, setconfig16 expects host order. | ||
1886 | * prism2mgmt_p80211int2prism2int(wordbuf, &flags); | ||
1887 | */ | ||
1888 | *wordbuf = flags; | ||
1889 | result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); | ||
1890 | } | ||
1891 | } | ||
1892 | |||
1893 | DBFEXIT; | ||
1894 | return(result); | ||
1895 | } | ||
1896 | |||
1897 | /*---------------------------------------------------------------- | ||
1898 | * prism2mib_appcfinfoflag | ||
1899 | * | ||
1900 | * Get/set a single flag in the APPCFINFO record. | ||
1901 | * | ||
1902 | * MIB record parameters: | ||
1903 | * parm1 Bit to get/set. | ||
1904 | * parm2 Not used. | ||
1905 | * parm3 Not used. | ||
1906 | * | ||
1907 | * Arguments: | ||
1908 | * mib MIB record. | ||
1909 | * isget MIBGET/MIBSET flag. | ||
1910 | * wlandev wlan device structure. | ||
1911 | * priv "priv" structure. | ||
1912 | * hw "hw" structure. | ||
1913 | * msg Message structure. | ||
1914 | * data Data buffer. | ||
1915 | * | ||
1916 | * Returns: | ||
1917 | * 0 - Success. | ||
1918 | * ~0 - Error. | ||
1919 | * | ||
1920 | ----------------------------------------------------------------*/ | ||
1921 | |||
1922 | static int prism2mib_appcfinfoflag( | ||
1923 | mibrec_t *mib, | ||
1924 | int isget, | ||
1925 | wlandevice_t *wlandev, | ||
1926 | hfa384x_t *hw, | ||
1927 | p80211msg_dot11req_mibset_t *msg, | ||
1928 | void *data) | ||
1929 | { | ||
1930 | int result; | ||
1931 | UINT32 *uint32 = (UINT32*) data; | ||
1932 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1933 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
1934 | UINT16 word; | ||
1935 | |||
1936 | DBFENTER; | ||
1937 | |||
1938 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFAPPCFINFO, | ||
1939 | bytebuf, HFA384x_RID_CNFAPPCFINFO_LEN); | ||
1940 | if (result == 0) { | ||
1941 | if (isget) { | ||
1942 | *uint32 = (hfa384x2host_16(wordbuf[3]) & mib->parm1) ? | ||
1943 | P80211ENUM_truth_true : P80211ENUM_truth_false; | ||
1944 | } else { | ||
1945 | word = hfa384x2host_16(wordbuf[3]); | ||
1946 | word = ((*uint32) == P80211ENUM_truth_true) ? | ||
1947 | (word | mib->parm1) : (word & ~mib->parm1); | ||
1948 | wordbuf[3] = host2hfa384x_16(word); | ||
1949 | result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFAPPCFINFO, | ||
1950 | bytebuf, HFA384x_RID_CNFAPPCFINFO_LEN); | ||
1951 | } | ||
1952 | } | ||
1953 | |||
1954 | DBFEXIT; | ||
1955 | return(result); | ||
1956 | } | ||
1957 | |||
1958 | /*---------------------------------------------------------------- | ||
1959 | * prism2mib_regulatorydomains | ||
1960 | * | ||
1961 | * Get regulatory domain data. | ||
1962 | * | ||
1963 | * MIB record parameters: | ||
1964 | * parm1 Prism2 RID value. | ||
1965 | * parm2 Number of bytes of RID data. | ||
1966 | * parm3 Not used. | ||
1967 | * | ||
1968 | * Arguments: | ||
1969 | * mib MIB record. | ||
1970 | * isget MIBGET/MIBSET flag. | ||
1971 | * wlandev wlan device structure. | ||
1972 | * priv "priv" structure. | ||
1973 | * hw "hw" structure. | ||
1974 | * msg Message structure. | ||
1975 | * data Data buffer. | ||
1976 | * | ||
1977 | * Returns: | ||
1978 | * 0 - Success. | ||
1979 | * ~0 - Error. | ||
1980 | * | ||
1981 | ----------------------------------------------------------------*/ | ||
1982 | |||
1983 | static int prism2mib_regulatorydomains( | ||
1984 | mibrec_t *mib, | ||
1985 | int isget, | ||
1986 | wlandevice_t *wlandev, | ||
1987 | hfa384x_t *hw, | ||
1988 | p80211msg_dot11req_mibset_t *msg, | ||
1989 | void *data) | ||
1990 | { | ||
1991 | int result; | ||
1992 | UINT32 cnt; | ||
1993 | p80211pstrd_t *pstr = (p80211pstrd_t*) data; | ||
1994 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
1995 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
1996 | |||
1997 | DBFENTER; | ||
1998 | |||
1999 | result = 0; | ||
2000 | |||
2001 | if (isget) { | ||
2002 | result = hfa384x_drvr_getconfig(hw, mib->parm1, wordbuf, mib->parm2); | ||
2003 | prism2mgmt_prism2int2p80211int(wordbuf, &cnt); | ||
2004 | pstr->len = (UINT8) cnt; | ||
2005 | memcpy(pstr->data, &wordbuf[1], pstr->len); | ||
2006 | } | ||
2007 | |||
2008 | DBFEXIT; | ||
2009 | return(result); | ||
2010 | } | ||
2011 | |||
2012 | /*---------------------------------------------------------------- | ||
2013 | * prism2mib_wepdefaultkey | ||
2014 | * | ||
2015 | * Get/set WEP default keys. | ||
2016 | * | ||
2017 | * MIB record parameters: | ||
2018 | * parm1 Prism2 RID value. | ||
2019 | * parm2 Number of bytes of RID data. | ||
2020 | * parm3 Not used. | ||
2021 | * | ||
2022 | * Arguments: | ||
2023 | * mib MIB record. | ||
2024 | * isget MIBGET/MIBSET flag. | ||
2025 | * wlandev wlan device structure. | ||
2026 | * priv "priv" structure. | ||
2027 | * hw "hw" structure. | ||
2028 | * msg Message structure. | ||
2029 | * data Data buffer. | ||
2030 | * | ||
2031 | * Returns: | ||
2032 | * 0 - Success. | ||
2033 | * ~0 - Error. | ||
2034 | * | ||
2035 | ----------------------------------------------------------------*/ | ||
2036 | |||
2037 | static int prism2mib_wepdefaultkey( | ||
2038 | mibrec_t *mib, | ||
2039 | int isget, | ||
2040 | wlandevice_t *wlandev, | ||
2041 | hfa384x_t *hw, | ||
2042 | p80211msg_dot11req_mibset_t *msg, | ||
2043 | void *data) | ||
2044 | { | ||
2045 | int result; | ||
2046 | p80211pstrd_t *pstr = (p80211pstrd_t*) data; | ||
2047 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
2048 | UINT16 len; | ||
2049 | |||
2050 | DBFENTER; | ||
2051 | |||
2052 | if (isget) { | ||
2053 | result = 0; /* Should never happen. */ | ||
2054 | } else { | ||
2055 | len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN : | ||
2056 | HFA384x_RID_CNFWEPDEFAULTKEY_LEN; | ||
2057 | memset(bytebuf, 0, len); | ||
2058 | prism2mgmt_pstr2bytearea(bytebuf, pstr); | ||
2059 | result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len); | ||
2060 | } | ||
2061 | |||
2062 | DBFEXIT; | ||
2063 | return(result); | ||
2064 | } | ||
2065 | |||
2066 | /*---------------------------------------------------------------- | ||
2067 | * prism2mib_powermanagement | ||
2068 | * | ||
2069 | * Get/set 802.11 power management value. Note that this is defined differently | ||
2070 | * by 802.11 and Prism2: | ||
2071 | * | ||
2072 | * Meaning 802.11 Prism2 | ||
2073 | * active 1 false | ||
2074 | * powersave 2 true | ||
2075 | * | ||
2076 | * MIB record parameters: | ||
2077 | * parm1 Prism2 RID value. | ||
2078 | * parm2 Not used. | ||
2079 | * parm3 Not used. | ||
2080 | * | ||
2081 | * Arguments: | ||
2082 | * mib MIB record. | ||
2083 | * isget MIBGET/MIBSET flag. | ||
2084 | * wlandev wlan device structure. | ||
2085 | * priv "priv" structure. | ||
2086 | * hw "hw" structure. | ||
2087 | * msg Message structure. | ||
2088 | * data Data buffer. | ||
2089 | * | ||
2090 | * Returns: | ||
2091 | * 0 - Success. | ||
2092 | * ~0 - Error. | ||
2093 | * | ||
2094 | ----------------------------------------------------------------*/ | ||
2095 | |||
2096 | static int prism2mib_powermanagement( | ||
2097 | mibrec_t *mib, | ||
2098 | int isget, | ||
2099 | wlandevice_t *wlandev, | ||
2100 | hfa384x_t *hw, | ||
2101 | p80211msg_dot11req_mibset_t *msg, | ||
2102 | void *data) | ||
2103 | { | ||
2104 | int result; | ||
2105 | UINT32 *uint32 = (UINT32*) data; | ||
2106 | UINT32 value; | ||
2107 | |||
2108 | DBFENTER; | ||
2109 | |||
2110 | if (isget) { | ||
2111 | result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value); | ||
2112 | *uint32 = (value == 0) ? 1 : 2; | ||
2113 | } else { | ||
2114 | value = ((*uint32) == 1) ? 0 : 1; | ||
2115 | result = prism2mib_uint32(mib, isget, wlandev, hw, msg, &value); | ||
2116 | } | ||
2117 | |||
2118 | DBFEXIT; | ||
2119 | return(result); | ||
2120 | } | ||
2121 | |||
2122 | /*---------------------------------------------------------------- | ||
2123 | * prism2mib_preamble | ||
2124 | * | ||
2125 | * Get/set Prism2 short preamble | ||
2126 | * | ||
2127 | * MIB record parameters: | ||
2128 | * parm1 Prism2 RID value. | ||
2129 | * parm2 Not used. | ||
2130 | * parm3 Not used. | ||
2131 | * | ||
2132 | * Arguments: | ||
2133 | * mib MIB record. | ||
2134 | * isget MIBGET/MIBSET flag. | ||
2135 | * wlandev wlan device structure. | ||
2136 | * priv "priv" structure. | ||
2137 | * hw "hw" structure. | ||
2138 | * msg Message structure. | ||
2139 | * data Data buffer. | ||
2140 | * | ||
2141 | * Returns: | ||
2142 | * 0 - Success. | ||
2143 | * ~0 - Error. | ||
2144 | * | ||
2145 | ----------------------------------------------------------------*/ | ||
2146 | |||
2147 | static int prism2mib_preamble( | ||
2148 | mibrec_t *mib, | ||
2149 | int isget, | ||
2150 | wlandevice_t *wlandev, | ||
2151 | hfa384x_t *hw, | ||
2152 | p80211msg_dot11req_mibset_t *msg, | ||
2153 | void *data) | ||
2154 | { | ||
2155 | int result; | ||
2156 | UINT32 *uint32 = (UINT32*) data; | ||
2157 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
2158 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
2159 | |||
2160 | DBFENTER; | ||
2161 | |||
2162 | if (isget) { | ||
2163 | result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); | ||
2164 | *uint32 = *wordbuf; | ||
2165 | } else { | ||
2166 | *wordbuf = *uint32; | ||
2167 | result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); | ||
2168 | } | ||
2169 | |||
2170 | DBFEXIT; | ||
2171 | return(result); | ||
2172 | } | ||
2173 | |||
2174 | /*---------------------------------------------------------------- | ||
2175 | * prism2mib_privacyinvoked | ||
2176 | * | ||
2177 | * Get/set the dot11PrivacyInvoked value. | ||
2178 | * | ||
2179 | * MIB record parameters: | ||
2180 | * parm1 Prism2 RID value. | ||
2181 | * parm2 Bit value for PrivacyInvoked flag. | ||
2182 | * parm3 Not used. | ||
2183 | * | ||
2184 | * Arguments: | ||
2185 | * mib MIB record. | ||
2186 | * isget MIBGET/MIBSET flag. | ||
2187 | * wlandev wlan device structure. | ||
2188 | * priv "priv" structure. | ||
2189 | * hw "hw" structure. | ||
2190 | * msg Message structure. | ||
2191 | * data Data buffer. | ||
2192 | * | ||
2193 | * Returns: | ||
2194 | * 0 - Success. | ||
2195 | * ~0 - Error. | ||
2196 | * | ||
2197 | ----------------------------------------------------------------*/ | ||
2198 | |||
2199 | static int prism2mib_privacyinvoked( | ||
2200 | mibrec_t *mib, | ||
2201 | int isget, | ||
2202 | wlandevice_t *wlandev, | ||
2203 | hfa384x_t *hw, | ||
2204 | p80211msg_dot11req_mibset_t *msg, | ||
2205 | void *data) | ||
2206 | { | ||
2207 | int result; | ||
2208 | |||
2209 | DBFENTER; | ||
2210 | |||
2211 | if (wlandev->hostwep & HOSTWEP_DECRYPT) { | ||
2212 | if (wlandev->hostwep & HOSTWEP_DECRYPT) | ||
2213 | mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_RXCRYPT; | ||
2214 | if (wlandev->hostwep & HOSTWEP_ENCRYPT) | ||
2215 | mib->parm2 |= HFA384x_WEPFLAGS_DISABLE_TXCRYPT; | ||
2216 | } | ||
2217 | |||
2218 | result = prism2mib_flag(mib, isget, wlandev, hw, msg, data); | ||
2219 | |||
2220 | DBFEXIT; | ||
2221 | return(result); | ||
2222 | } | ||
2223 | |||
2224 | /*---------------------------------------------------------------- | ||
2225 | * prism2mib_excludeunencrypted | ||
2226 | * | ||
2227 | * Get/set the dot11ExcludeUnencrypted value. | ||
2228 | * | ||
2229 | * MIB record parameters: | ||
2230 | * parm1 Prism2 RID value. | ||
2231 | * parm2 Bit value for ExcludeUnencrypted flag. | ||
2232 | * parm3 Not used. | ||
2233 | * | ||
2234 | * Arguments: | ||
2235 | * mib MIB record. | ||
2236 | * isget MIBGET/MIBSET flag. | ||
2237 | * wlandev wlan device structure. | ||
2238 | * priv "priv" structure. | ||
2239 | * hw "hw" structure. | ||
2240 | * msg Message structure. | ||
2241 | * data Data buffer. | ||
2242 | * | ||
2243 | * Returns: | ||
2244 | * 0 - Success. | ||
2245 | * ~0 - Error. | ||
2246 | * | ||
2247 | ----------------------------------------------------------------*/ | ||
2248 | |||
2249 | static int prism2mib_excludeunencrypted( | ||
2250 | mibrec_t *mib, | ||
2251 | int isget, | ||
2252 | wlandevice_t *wlandev, | ||
2253 | hfa384x_t *hw, | ||
2254 | p80211msg_dot11req_mibset_t *msg, | ||
2255 | void *data) | ||
2256 | { | ||
2257 | int result; | ||
2258 | |||
2259 | DBFENTER; | ||
2260 | |||
2261 | result = prism2mib_flag(mib, isget, wlandev, hw, msg, data); | ||
2262 | |||
2263 | DBFEXIT; | ||
2264 | return(result); | ||
2265 | } | ||
2266 | |||
2267 | /*---------------------------------------------------------------- | ||
2268 | * prism2mib_fragmentationthreshold | ||
2269 | * | ||
2270 | * Get/set the fragmentation threshold. | ||
2271 | * | ||
2272 | * MIB record parameters: | ||
2273 | * parm1 Prism2 RID value. | ||
2274 | * parm2 Not used. | ||
2275 | * parm3 Not used. | ||
2276 | * | ||
2277 | * Arguments: | ||
2278 | * mib MIB record. | ||
2279 | * isget MIBGET/MIBSET flag. | ||
2280 | * wlandev wlan device structure. | ||
2281 | * priv "priv" structure. | ||
2282 | * hw "hw" structure. | ||
2283 | * msg Message structure. | ||
2284 | * data Data buffer. | ||
2285 | * | ||
2286 | * Returns: | ||
2287 | * 0 - Success. | ||
2288 | * ~0 - Error. | ||
2289 | * | ||
2290 | ----------------------------------------------------------------*/ | ||
2291 | |||
2292 | static int prism2mib_fragmentationthreshold( | ||
2293 | mibrec_t *mib, | ||
2294 | int isget, | ||
2295 | wlandevice_t *wlandev, | ||
2296 | hfa384x_t *hw, | ||
2297 | p80211msg_dot11req_mibset_t *msg, | ||
2298 | void *data) | ||
2299 | { | ||
2300 | int result; | ||
2301 | UINT32 *uint32 = (UINT32*) data; | ||
2302 | |||
2303 | DBFENTER; | ||
2304 | |||
2305 | if (!isget) | ||
2306 | if ((*uint32) % 2) { | ||
2307 | WLAN_LOG_WARNING("Attempt to set odd number " | ||
2308 | "FragmentationThreshold\n"); | ||
2309 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2310 | return(0); | ||
2311 | } | ||
2312 | |||
2313 | result = prism2mib_uint32(mib, isget, wlandev, hw, msg, data); | ||
2314 | |||
2315 | DBFEXIT; | ||
2316 | return(result); | ||
2317 | } | ||
2318 | |||
2319 | /*---------------------------------------------------------------- | ||
2320 | * prism2mib_operationalrateset | ||
2321 | * | ||
2322 | * Get/set the operational rate set. | ||
2323 | * | ||
2324 | * MIB record parameters: | ||
2325 | * parm1 Prism2 RID value. | ||
2326 | * parm2 Not used. | ||
2327 | * parm3 Not used. | ||
2328 | * | ||
2329 | * Arguments: | ||
2330 | * mib MIB record. | ||
2331 | * isget MIBGET/MIBSET flag. | ||
2332 | * wlandev wlan device structure. | ||
2333 | * priv "priv" structure. | ||
2334 | * hw "hw" structure. | ||
2335 | * msg Message structure. | ||
2336 | * data Data buffer. | ||
2337 | * | ||
2338 | * Returns: | ||
2339 | * 0 - Success. | ||
2340 | * ~0 - Error. | ||
2341 | * | ||
2342 | ----------------------------------------------------------------*/ | ||
2343 | |||
2344 | static int prism2mib_operationalrateset( | ||
2345 | mibrec_t *mib, | ||
2346 | int isget, | ||
2347 | wlandevice_t *wlandev, | ||
2348 | hfa384x_t *hw, | ||
2349 | p80211msg_dot11req_mibset_t *msg, | ||
2350 | void *data) | ||
2351 | { | ||
2352 | int result; | ||
2353 | p80211pstrd_t *pstr = (p80211pstrd_t *) data; | ||
2354 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
2355 | UINT16 *wordbuf = (UINT16*) bytebuf; | ||
2356 | |||
2357 | DBFENTER; | ||
2358 | |||
2359 | if (isget) { | ||
2360 | result = hfa384x_drvr_getconfig16(hw, mib->parm1, wordbuf); | ||
2361 | prism2mgmt_get_oprateset(wordbuf, pstr); | ||
2362 | } else { | ||
2363 | prism2mgmt_set_oprateset(wordbuf, pstr); | ||
2364 | result = hfa384x_drvr_setconfig16(hw, mib->parm1, *wordbuf); | ||
2365 | result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, *wordbuf); | ||
2366 | } | ||
2367 | |||
2368 | DBFEXIT; | ||
2369 | return(result); | ||
2370 | } | ||
2371 | |||
2372 | /*---------------------------------------------------------------- | ||
2373 | * prism2mib_groupaddress | ||
2374 | * | ||
2375 | * Get/set the dot11GroupAddressesTable. | ||
2376 | * | ||
2377 | * MIB record parameters: | ||
2378 | * parm1 Not used. | ||
2379 | * parm2 Not used. | ||
2380 | * parm3 Not used. | ||
2381 | * | ||
2382 | * Arguments: | ||
2383 | * mib MIB record. | ||
2384 | * isget MIBGET/MIBSET flag. | ||
2385 | * wlandev wlan device structure. | ||
2386 | * priv "priv" structure. | ||
2387 | * hw "hw" structure. | ||
2388 | * msg Message structure. | ||
2389 | * data Data buffer. | ||
2390 | * | ||
2391 | * Returns: | ||
2392 | * 0 - Success. | ||
2393 | * ~0 - Error. | ||
2394 | * | ||
2395 | ----------------------------------------------------------------*/ | ||
2396 | |||
2397 | static int prism2mib_groupaddress( | ||
2398 | mibrec_t *mib, | ||
2399 | int isget, | ||
2400 | wlandevice_t *wlandev, | ||
2401 | hfa384x_t *hw, | ||
2402 | p80211msg_dot11req_mibset_t *msg, | ||
2403 | void *data) | ||
2404 | { | ||
2405 | int result; | ||
2406 | p80211pstrd_t *pstr = (p80211pstrd_t *) data; | ||
2407 | UINT8 bytebuf[MIB_TMP_MAXLEN]; | ||
2408 | UINT16 len; | ||
2409 | |||
2410 | DBFENTER; | ||
2411 | |||
2412 | /* TODO: fix this. f/w doesn't support mcast filters */ | ||
2413 | |||
2414 | if (isget) { | ||
2415 | prism2mgmt_get_grpaddr(mib->did, pstr, hw); | ||
2416 | return(0); | ||
2417 | } | ||
2418 | |||
2419 | result = prism2mgmt_set_grpaddr(mib->did, bytebuf, pstr, hw); | ||
2420 | if (result != 0) { | ||
2421 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2422 | return(result); | ||
2423 | } | ||
2424 | |||
2425 | if (hw->dot11_grpcnt <= MAX_PRISM2_GRP_ADDR) { | ||
2426 | len = hw->dot11_grpcnt * WLAN_ADDR_LEN; | ||
2427 | memcpy(bytebuf, hw->dot11_grp_addr[0], len); | ||
2428 | result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR, bytebuf, len); | ||
2429 | |||
2430 | /* | ||
2431 | ** Turn off promiscuous mode if count is equal to MAX. We may | ||
2432 | ** have been at a higher count in promiscuous mode and need to | ||
2433 | ** turn it off. | ||
2434 | */ | ||
2435 | |||
2436 | /* but only if we're not already in promisc mode. :) */ | ||
2437 | if ((hw->dot11_grpcnt == MAX_PRISM2_GRP_ADDR) && | ||
2438 | !( wlandev->netdev->flags & IFF_PROMISC)) { | ||
2439 | result = hfa384x_drvr_setconfig16(hw, | ||
2440 | HFA384x_RID_PROMISCMODE, 0); | ||
2441 | } | ||
2442 | } else { | ||
2443 | |||
2444 | /* | ||
2445 | ** Clear group addresses in card and set to promiscuous mode. | ||
2446 | */ | ||
2447 | |||
2448 | memset(bytebuf, 0, sizeof(bytebuf)); | ||
2449 | result = hfa384x_drvr_setconfig(hw, HFA384x_RID_GROUPADDR, | ||
2450 | bytebuf, 0); | ||
2451 | if (result == 0) { | ||
2452 | result = hfa384x_drvr_setconfig16(hw, | ||
2453 | HFA384x_RID_PROMISCMODE, 1); | ||
2454 | } | ||
2455 | } | ||
2456 | |||
2457 | DBFEXIT; | ||
2458 | return(result); | ||
2459 | } | ||
2460 | |||
2461 | /*---------------------------------------------------------------- | ||
2462 | * prism2mib_fwid | ||
2463 | * | ||
2464 | * Get the firmware ID. | ||
2465 | * | ||
2466 | * MIB record parameters: | ||
2467 | * parm1 Not used. | ||
2468 | * parm2 Not used. | ||
2469 | * parm3 Not used. | ||
2470 | * | ||
2471 | * Arguments: | ||
2472 | * mib MIB record. | ||
2473 | * isget MIBGET/MIBSET flag. | ||
2474 | * wlandev wlan device structure. | ||
2475 | * priv "priv" structure. | ||
2476 | * hw "hw" structure. | ||
2477 | * msg Message structure. | ||
2478 | * data Data buffer. | ||
2479 | * | ||
2480 | * Returns: | ||
2481 | * 0 - Success. | ||
2482 | * ~0 - Error. | ||
2483 | * | ||
2484 | ----------------------------------------------------------------*/ | ||
2485 | |||
2486 | static int prism2mib_fwid( | ||
2487 | mibrec_t *mib, | ||
2488 | int isget, | ||
2489 | wlandevice_t *wlandev, | ||
2490 | hfa384x_t *hw, | ||
2491 | p80211msg_dot11req_mibset_t *msg, | ||
2492 | void *data) | ||
2493 | { | ||
2494 | int result; | ||
2495 | p80211pstrd_t *pstr = (p80211pstrd_t *) data; | ||
2496 | hfa384x_FWID_t fwid; | ||
2497 | |||
2498 | DBFENTER; | ||
2499 | |||
2500 | if (isget) { | ||
2501 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_FWID, | ||
2502 | &fwid, HFA384x_RID_FWID_LEN); | ||
2503 | if (mib->did == DIDmib_p2_p2NIC_p2PrimaryFWID) { | ||
2504 | fwid.primary[HFA384x_FWID_LEN - 1] = '\0'; | ||
2505 | pstr->len = strlen(fwid.primary); | ||
2506 | memcpy(pstr->data, fwid.primary, pstr->len); | ||
2507 | } else { | ||
2508 | fwid.secondary[HFA384x_FWID_LEN - 1] = '\0'; | ||
2509 | pstr->len = strlen(fwid.secondary); | ||
2510 | memcpy(pstr->data, fwid.secondary, pstr->len); | ||
2511 | } | ||
2512 | } else | ||
2513 | result = 0; /* Should never happen. */ | ||
2514 | |||
2515 | DBFEXIT; | ||
2516 | return(result); | ||
2517 | } | ||
2518 | |||
2519 | /*---------------------------------------------------------------- | ||
2520 | * prism2mib_authalg | ||
2521 | * | ||
2522 | * Get values from the AuhtenticationAlgorithmsTable. | ||
2523 | * | ||
2524 | * MIB record parameters: | ||
2525 | * parm1 Table index (1-6). | ||
2526 | * parm2 Not used. | ||
2527 | * parm3 Not used. | ||
2528 | * | ||
2529 | * Arguments: | ||
2530 | * mib MIB record. | ||
2531 | * isget MIBGET/MIBSET flag. | ||
2532 | * wlandev wlan device structure. | ||
2533 | * priv "priv" structure. | ||
2534 | * hw "hw" structure. | ||
2535 | * msg Message structure. | ||
2536 | * data Data buffer. | ||
2537 | * | ||
2538 | * Returns: | ||
2539 | * 0 - Success. | ||
2540 | * ~0 - Error. | ||
2541 | * | ||
2542 | ----------------------------------------------------------------*/ | ||
2543 | |||
2544 | static int prism2mib_authalg( | ||
2545 | mibrec_t *mib, | ||
2546 | int isget, | ||
2547 | wlandevice_t *wlandev, | ||
2548 | hfa384x_t *hw, | ||
2549 | p80211msg_dot11req_mibset_t *msg, | ||
2550 | void *data) | ||
2551 | { | ||
2552 | UINT32 *uint32 = (UINT32*) data; | ||
2553 | |||
2554 | DBFENTER; | ||
2555 | |||
2556 | /* MSM: pkx supplied code that code queries RID FD4D....but the f/w's | ||
2557 | * results are bogus. Therefore, we have to simulate the appropriate | ||
2558 | * results here in the driver based on our knowledge of existing MAC | ||
2559 | * features. That's the whole point behind this ugly function. | ||
2560 | */ | ||
2561 | |||
2562 | if (isget) { | ||
2563 | msg->resultcode.data = P80211ENUM_resultcode_success; | ||
2564 | switch (mib->parm1) { | ||
2565 | case 1: /* Open System */ | ||
2566 | *uint32 = P80211ENUM_authalg_opensystem; | ||
2567 | break; | ||
2568 | case 2: /* SharedKey */ | ||
2569 | *uint32 = P80211ENUM_authalg_sharedkey; | ||
2570 | break; | ||
2571 | default: | ||
2572 | *uint32 = 0; | ||
2573 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2574 | break; | ||
2575 | } | ||
2576 | } | ||
2577 | |||
2578 | DBFEXIT; | ||
2579 | return(0); | ||
2580 | } | ||
2581 | |||
2582 | /*---------------------------------------------------------------- | ||
2583 | * prism2mib_authalgenable | ||
2584 | * | ||
2585 | * Get/set the enable values from the AuhtenticationAlgorithmsTable. | ||
2586 | * | ||
2587 | * MIB record parameters: | ||
2588 | * parm1 Table index (1-6). | ||
2589 | * parm2 Not used. | ||
2590 | * parm3 Not used. | ||
2591 | * | ||
2592 | * Arguments: | ||
2593 | * mib MIB record. | ||
2594 | * isget MIBGET/MIBSET flag. | ||
2595 | * wlandev wlan device structure. | ||
2596 | * priv "priv" structure. | ||
2597 | * hw "hw" structure. | ||
2598 | * msg Message structure. | ||
2599 | * data Data buffer. | ||
2600 | * | ||
2601 | * Returns: | ||
2602 | * 0 - Success. | ||
2603 | * ~0 - Error. | ||
2604 | * | ||
2605 | ----------------------------------------------------------------*/ | ||
2606 | |||
2607 | static int prism2mib_authalgenable( | ||
2608 | mibrec_t *mib, | ||
2609 | int isget, | ||
2610 | wlandevice_t *wlandev, | ||
2611 | hfa384x_t *hw, | ||
2612 | p80211msg_dot11req_mibset_t *msg, | ||
2613 | void *data) | ||
2614 | { | ||
2615 | int result; | ||
2616 | UINT32 *uint32 = (UINT32*) data; | ||
2617 | |||
2618 | int index; | ||
2619 | UINT16 cnf_auth; | ||
2620 | UINT16 mask; | ||
2621 | |||
2622 | DBFENTER; | ||
2623 | |||
2624 | index = mib->parm1 - 1; | ||
2625 | |||
2626 | result = hfa384x_drvr_getconfig16( hw, | ||
2627 | HFA384x_RID_CNFAUTHENTICATION, &cnf_auth); | ||
2628 | WLAN_LOG_DEBUG(2,"cnfAuthentication0=%d, index=%d\n", cnf_auth, index); | ||
2629 | |||
2630 | if (isget) { | ||
2631 | if ( index == 0 || index == 1 ) { | ||
2632 | *uint32 = (cnf_auth & (1<<index)) ? | ||
2633 | P80211ENUM_truth_true: P80211ENUM_truth_false; | ||
2634 | } else { | ||
2635 | *uint32 = P80211ENUM_truth_false; | ||
2636 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2637 | } | ||
2638 | } else { | ||
2639 | if ( index == 0 || index == 1 ) { | ||
2640 | mask = 1 << index; | ||
2641 | if (*uint32==P80211ENUM_truth_true ) { | ||
2642 | cnf_auth |= mask; | ||
2643 | } else { | ||
2644 | cnf_auth &= ~mask; | ||
2645 | } | ||
2646 | result = hfa384x_drvr_setconfig16( hw, | ||
2647 | HFA384x_RID_CNFAUTHENTICATION, cnf_auth); | ||
2648 | WLAN_LOG_DEBUG(2,"cnfAuthentication:=%d\n", cnf_auth); | ||
2649 | if ( result ) { | ||
2650 | WLAN_LOG_DEBUG(1,"Unable to set p2cnfAuthentication to %d\n", cnf_auth); | ||
2651 | msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; | ||
2652 | } | ||
2653 | } else { | ||
2654 | msg->resultcode.data = P80211ENUM_resultcode_not_supported; | ||
2655 | } | ||
2656 | } | ||
2657 | |||
2658 | DBFEXIT; | ||
2659 | return(result); | ||
2660 | } | ||
2661 | |||
2662 | /*---------------------------------------------------------------- | ||
2663 | * prism2mib_priv | ||
2664 | * | ||
2665 | * Get/set values in the "priv" data structure. | ||
2666 | * | ||
2667 | * MIB record parameters: | ||
2668 | * parm1 Not used. | ||
2669 | * parm2 Not used. | ||
2670 | * parm3 Not used. | ||
2671 | * | ||
2672 | * Arguments: | ||
2673 | * mib MIB record. | ||
2674 | * isget MIBGET/MIBSET flag. | ||
2675 | * wlandev wlan device structure. | ||
2676 | * priv "priv" structure. | ||
2677 | * hw "hw" structure. | ||
2678 | * msg Message structure. | ||
2679 | * data Data buffer. | ||
2680 | * | ||
2681 | * Returns: | ||
2682 | * 0 - Success. | ||
2683 | * ~0 - Error. | ||
2684 | * | ||
2685 | ----------------------------------------------------------------*/ | ||
2686 | |||
2687 | static int prism2mib_priv( | ||
2688 | mibrec_t *mib, | ||
2689 | int isget, | ||
2690 | wlandevice_t *wlandev, | ||
2691 | hfa384x_t *hw, | ||
2692 | p80211msg_dot11req_mibset_t *msg, | ||
2693 | void *data) | ||
2694 | { | ||
2695 | UINT32 *uint32 = (UINT32*) data; | ||
2696 | p80211pstrd_t *pstr = (p80211pstrd_t*) data; | ||
2697 | p80211macarray_t *macarray = (p80211macarray_t *) data; | ||
2698 | |||
2699 | int i, cnt, result, done; | ||
2700 | |||
2701 | prism2sta_authlist_t old; | ||
2702 | |||
2703 | /* | ||
2704 | ** "test" is a lot longer than necessary but who cares? ...as long as | ||
2705 | ** it is long enough! | ||
2706 | */ | ||
2707 | |||
2708 | UINT8 test[sizeof(wlandev->rx) + sizeof(hw->tallies)]; | ||
2709 | |||
2710 | DBFENTER; | ||
2711 | |||
2712 | switch (mib->did) { | ||
2713 | case DIDmib_p2_p2Table_p2ReceivedFrameStatistics: | ||
2714 | |||
2715 | /* | ||
2716 | ** Note: The values in this record are changed by the | ||
2717 | ** interrupt handler and therefore cannot be guaranteed | ||
2718 | ** to be stable while they are being copied. However, | ||
2719 | ** the interrupt handler will take priority over this | ||
2720 | ** code. Hence, if the same values are copied twice, | ||
2721 | ** then we are ensured that the values have not been | ||
2722 | ** changed. If they have, then just try again. Don't | ||
2723 | ** try more than 10 times...if we still haven't got it, | ||
2724 | ** then the values we do have are probably good enough. | ||
2725 | ** This scheme for copying values is used in order to | ||
2726 | ** prevent having to block the interrupt handler while | ||
2727 | ** we copy the values. | ||
2728 | */ | ||
2729 | |||
2730 | if (isget) | ||
2731 | for (i = 0; i < 10; i++) { | ||
2732 | memcpy(data, &wlandev->rx, sizeof(wlandev->rx)); | ||
2733 | memcpy(test, &wlandev->rx, sizeof(wlandev->rx)); | ||
2734 | if (memcmp(data, test, sizeof(wlandev->rx)) == 0) break; | ||
2735 | } | ||
2736 | |||
2737 | break; | ||
2738 | |||
2739 | case DIDmib_p2_p2Table_p2CommunicationTallies: | ||
2740 | |||
2741 | /* | ||
2742 | ** Note: The values in this record are changed by the | ||
2743 | ** interrupt handler and therefore cannot be guaranteed | ||
2744 | ** to be stable while they are being copied. See the | ||
2745 | ** note above about copying values. | ||
2746 | */ | ||
2747 | |||
2748 | if (isget) { | ||
2749 | result = hfa384x_drvr_commtallies(hw); | ||
2750 | |||
2751 | /* ?????? We need to wait a bit here for the */ | ||
2752 | /* tallies to get updated. ?????? */ | ||
2753 | /* MSM: TODO: The right way to do this is to | ||
2754 | * add a "commtallie" wait queue to the | ||
2755 | * priv structure that gets run every time | ||
2756 | * we receive a commtally info frame. | ||
2757 | * This process would sleep on that | ||
2758 | * queue and get awakened when the | ||
2759 | * the requested info frame arrives. | ||
2760 | * Don't have time to do and test this | ||
2761 | * right now. | ||
2762 | */ | ||
2763 | |||
2764 | /* Ugh, this is nasty. */ | ||
2765 | for (i = 0; i < 10; i++) { | ||
2766 | memcpy(data, | ||
2767 | &hw->tallies, | ||
2768 | sizeof(hw->tallies)); | ||
2769 | memcpy(test, | ||
2770 | &hw->tallies, | ||
2771 | sizeof(hw->tallies)); | ||
2772 | if ( memcmp(data, | ||
2773 | test, | ||
2774 | sizeof(hw->tallies)) == 0) | ||
2775 | break; | ||
2776 | } | ||
2777 | } | ||
2778 | |||
2779 | break; | ||
2780 | |||
2781 | case DIDmib_p2_p2Table_p2Authenticated: | ||
2782 | |||
2783 | if (isget) { | ||
2784 | prism2mib_priv_authlist(hw, &old); | ||
2785 | |||
2786 | macarray->cnt = 0; | ||
2787 | for (i = 0; i < old.cnt; i++) { | ||
2788 | if (!old.assoc[i]) { | ||
2789 | memcpy(macarray->data[macarray->cnt], old.addr[i], WLAN_ADDR_LEN); | ||
2790 | macarray->cnt++; | ||
2791 | } | ||
2792 | } | ||
2793 | } | ||
2794 | |||
2795 | break; | ||
2796 | |||
2797 | case DIDmib_p2_p2Table_p2Associated: | ||
2798 | |||
2799 | if (isget) { | ||
2800 | prism2mib_priv_authlist(hw, &old); | ||
2801 | |||
2802 | macarray->cnt = 0; | ||
2803 | for (i = 0; i < old.cnt; i++) { | ||
2804 | if (old.assoc[i]) { | ||
2805 | memcpy(macarray->data[macarray->cnt], old.addr[i], WLAN_ADDR_LEN); | ||
2806 | macarray->cnt++; | ||
2807 | } | ||
2808 | } | ||
2809 | } | ||
2810 | |||
2811 | break; | ||
2812 | |||
2813 | case DIDmib_p2_p2Table_p2PowerSaveUserCount: | ||
2814 | |||
2815 | if (isget) | ||
2816 | *uint32 = hw->psusercount; | ||
2817 | |||
2818 | break; | ||
2819 | |||
2820 | case DIDmib_p2_p2Table_p2Comment: | ||
2821 | |||
2822 | if (isget) { | ||
2823 | pstr->len = strlen(hw->comment); | ||
2824 | memcpy(pstr->data, hw->comment, pstr->len); | ||
2825 | } else { | ||
2826 | cnt = pstr->len; | ||
2827 | if (cnt < 0) cnt = 0; | ||
2828 | if (cnt >= sizeof(hw->comment)) | ||
2829 | cnt = sizeof(hw->comment)-1; | ||
2830 | memcpy(hw->comment, pstr->data, cnt); | ||
2831 | pstr->data[cnt] = '\0'; | ||
2832 | } | ||
2833 | |||
2834 | break; | ||
2835 | |||
2836 | case DIDmib_p2_p2Table_p2AccessMode: | ||
2837 | |||
2838 | if (isget) | ||
2839 | *uint32 = hw->accessmode; | ||
2840 | else | ||
2841 | prism2mib_priv_accessmode(hw, *uint32); | ||
2842 | |||
2843 | break; | ||
2844 | |||
2845 | case DIDmib_p2_p2Table_p2AccessAllow: | ||
2846 | |||
2847 | if (isget) { | ||
2848 | macarray->cnt = hw->allow.cnt; | ||
2849 | memcpy(macarray->data, hw->allow.addr, | ||
2850 | macarray->cnt*WLAN_ADDR_LEN); | ||
2851 | } else { | ||
2852 | prism2mib_priv_accessallow(hw, macarray); | ||
2853 | } | ||
2854 | |||
2855 | break; | ||
2856 | |||
2857 | case DIDmib_p2_p2Table_p2AccessDeny: | ||
2858 | |||
2859 | if (isget) { | ||
2860 | macarray->cnt = hw->deny.cnt; | ||
2861 | memcpy(macarray->data, hw->deny.addr, | ||
2862 | macarray->cnt*WLAN_ADDR_LEN); | ||
2863 | } else { | ||
2864 | prism2mib_priv_accessdeny(hw, macarray); | ||
2865 | } | ||
2866 | |||
2867 | break; | ||
2868 | |||
2869 | case DIDmib_p2_p2Table_p2ChannelInfoResults: | ||
2870 | |||
2871 | if (isget) { | ||
2872 | done = atomic_read(&hw->channel_info.done); | ||
2873 | if (done == 0) { | ||
2874 | msg->resultcode.status = P80211ENUM_msgitem_status_no_value; | ||
2875 | break; | ||
2876 | } | ||
2877 | if (done == 1) { | ||
2878 | msg->resultcode.status = P80211ENUM_msgitem_status_incomplete_itemdata; | ||
2879 | break; | ||
2880 | } | ||
2881 | |||
2882 | for (i = 0; i < 14; i++, uint32 += 5) { | ||
2883 | uint32[0] = i+1; | ||
2884 | uint32[1] = hw->channel_info.results.result[i].anl; | ||
2885 | uint32[2] = hw->channel_info.results.result[i].pnl; | ||
2886 | uint32[3] = (hw->channel_info.results.result[i].active & HFA384x_CHINFORESULT_BSSACTIVE) ? 1 : 0; | ||
2887 | uint32[4] = (hw->channel_info.results.result[i].active & HFA384x_CHINFORESULT_PCFACTIVE) ? 1 : 0; | ||
2888 | } | ||
2889 | } | ||
2890 | |||
2891 | break; | ||
2892 | |||
2893 | case DIDmib_dot11smt_dot11StationConfigTable_dot11DesiredBSSType: | ||
2894 | |||
2895 | if (isget) | ||
2896 | *uint32 = hw->dot11_desired_bss_type; | ||
2897 | else | ||
2898 | hw->dot11_desired_bss_type = *uint32; | ||
2899 | |||
2900 | break; | ||
2901 | |||
2902 | case DIDmib_lnx_lnxConfigTable_lnxRSNAIE: { | ||
2903 | hfa384x_WPAData_t wpa; | ||
2904 | if (isget) { | ||
2905 | hfa384x_drvr_getconfig( hw, HFA384x_RID_CNFWPADATA, | ||
2906 | (UINT8 *) &wpa, sizeof(wpa)); | ||
2907 | pstr->len = hfa384x2host_16(wpa.datalen); | ||
2908 | memcpy(pstr->data, wpa.data, pstr->len); | ||
2909 | } else { | ||
2910 | wpa.datalen = host2hfa384x_16(pstr->len); | ||
2911 | memcpy(wpa.data, pstr->data, pstr->len); | ||
2912 | |||
2913 | result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFWPADATA, | ||
2914 | (UINT8 *) &wpa, sizeof(wpa)); | ||
2915 | } | ||
2916 | break; | ||
2917 | } | ||
2918 | default: | ||
2919 | WLAN_LOG_ERROR("Unhandled DID 0x%08x\n", mib->did); | ||
2920 | } | ||
2921 | |||
2922 | DBFEXIT; | ||
2923 | return(0); | ||
2924 | } | ||
2925 | |||
2926 | /*---------------------------------------------------------------- | ||
2927 | * prism2mib_priv_authlist | ||
2928 | * | ||
2929 | * Get a copy of the list of authenticated stations. | ||
2930 | * | ||
2931 | * Arguments: | ||
2932 | * priv "priv" structure. | ||
2933 | * list List of authenticated stations. | ||
2934 | * | ||
2935 | * Returns: | ||
2936 | * Nothing | ||
2937 | * | ||
2938 | ----------------------------------------------------------------*/ | ||
2939 | |||
2940 | static void prism2mib_priv_authlist( | ||
2941 | hfa384x_t *hw, | ||
2942 | prism2sta_authlist_t *list) | ||
2943 | { | ||
2944 | prism2sta_authlist_t test; | ||
2945 | int i; | ||
2946 | |||
2947 | DBFENTER; | ||
2948 | |||
2949 | /* | ||
2950 | ** Note: The values in this record are changed by the interrupt | ||
2951 | ** handler and therefore cannot be guaranteed to be stable while | ||
2952 | ** they are being copied. However, the interrupt handler will | ||
2953 | ** take priority over this code. Hence, if the same values are | ||
2954 | ** copied twice, then we are ensured that the values have not | ||
2955 | ** been changed. If they have, then just try again. Don't try | ||
2956 | ** more than 10 times...the list of authenticated stations is | ||
2957 | ** unlikely to be changing frequently enough that we can't get | ||
2958 | ** a snapshot in 10 tries. Don't try more than this so that we | ||
2959 | ** don't risk locking-up for long periods of time. If we still | ||
2960 | ** haven't got the snapshot, then generate an error message and | ||
2961 | ** return an empty list (since this is the only valid list that | ||
2962 | ** we can guarentee). This scheme for copying values is used in | ||
2963 | ** order to prevent having to block the interrupt handler while | ||
2964 | ** we copy the values. | ||
2965 | */ | ||
2966 | |||
2967 | for (i = 0; i < 10; i++) { | ||
2968 | memcpy(list, &hw->authlist, sizeof(prism2sta_authlist_t)); | ||
2969 | memcpy(&test, &hw->authlist, sizeof(prism2sta_authlist_t)); | ||
2970 | if (memcmp(list, &test, sizeof(prism2sta_authlist_t)) == 0) | ||
2971 | break; | ||
2972 | } | ||
2973 | |||
2974 | if (i >= 10) { | ||
2975 | list->cnt = 0; | ||
2976 | WLAN_LOG_ERROR("Could not obtain snapshot of authenticated stations.\n"); | ||
2977 | } | ||
2978 | |||
2979 | DBFEXIT; | ||
2980 | return; | ||
2981 | } | ||
2982 | |||
2983 | /*---------------------------------------------------------------- | ||
2984 | * prism2mib_priv_accessmode | ||
2985 | * | ||
2986 | * Set the Access Mode. | ||
2987 | * | ||
2988 | * Arguments: | ||
2989 | * priv "priv" structure. | ||
2990 | * hw "hw" structure. | ||
2991 | * mode New access mode. | ||
2992 | * | ||
2993 | * Returns: | ||
2994 | * Nothing | ||
2995 | * | ||
2996 | ----------------------------------------------------------------*/ | ||
2997 | |||
2998 | static void prism2mib_priv_accessmode( | ||
2999 | hfa384x_t *hw, | ||
3000 | UINT32 mode) | ||
3001 | { | ||
3002 | prism2sta_authlist_t old; | ||
3003 | int i, j, deauth; | ||
3004 | UINT8 *addr; | ||
3005 | |||
3006 | DBFENTER; | ||
3007 | |||
3008 | /* | ||
3009 | ** If the mode is not changing or it is changing to "All", then it's | ||
3010 | ** okay to go ahead without a lot of messing around. Otherwise, the | ||
3011 | ** access mode is changing in a way that may leave some stations | ||
3012 | ** authenticated which should not be authenticated. It will be | ||
3013 | ** necessary to de-authenticate these stations. | ||
3014 | */ | ||
3015 | |||
3016 | if (mode == WLAN_ACCESS_ALL || mode == hw->accessmode) { | ||
3017 | hw->accessmode = mode; | ||
3018 | return; | ||
3019 | } | ||
3020 | |||
3021 | /* | ||
3022 | ** Switch to the new access mode. Once this is done, then the interrupt | ||
3023 | ** handler (which uses this value) will be prevented from authenticating | ||
3024 | ** ADDITIONAL stations which should not be authenticated. Then get a | ||
3025 | ** copy of the current list of authenticated stations. | ||
3026 | */ | ||
3027 | |||
3028 | hw->accessmode = mode; | ||
3029 | |||
3030 | prism2mib_priv_authlist(hw, &old); | ||
3031 | |||
3032 | /* | ||
3033 | ** Now go through the list of previously authenticated stations (some | ||
3034 | ** of which might de-authenticate themselves while we are processing it | ||
3035 | ** but that is okay). Any station which no longer matches the access | ||
3036 | ** mode, must be de-authenticated. | ||
3037 | */ | ||
3038 | |||
3039 | for (i = 0; i < old.cnt; i++) { | ||
3040 | addr = old.addr[i]; | ||
3041 | |||
3042 | if (mode == WLAN_ACCESS_NONE) | ||
3043 | deauth = 1; | ||
3044 | else { | ||
3045 | if (mode == WLAN_ACCESS_ALLOW) { | ||
3046 | for (j = 0; j < hw->allow.cnt; j++) | ||
3047 | if (memcmp(addr, hw->allow.addr[j], | ||
3048 | WLAN_ADDR_LEN) == 0) | ||
3049 | break; | ||
3050 | deauth = (j >= hw->allow.cnt); | ||
3051 | } else { | ||
3052 | for (j = 0; j < hw->deny.cnt; j++) | ||
3053 | if (memcmp(addr, hw->deny.addr[j], | ||
3054 | WLAN_ADDR_LEN) == 0) | ||
3055 | break; | ||
3056 | deauth = (j < hw->deny.cnt); | ||
3057 | } | ||
3058 | } | ||
3059 | |||
3060 | if (deauth) prism2mib_priv_deauthenticate(hw, addr); | ||
3061 | } | ||
3062 | |||
3063 | DBFEXIT; | ||
3064 | return; | ||
3065 | } | ||
3066 | |||
3067 | /*---------------------------------------------------------------- | ||
3068 | * prism2mib_priv_accessallow | ||
3069 | * | ||
3070 | * Change the list of allowed MAC addresses. | ||
3071 | * | ||
3072 | * Arguments: | ||
3073 | * priv "priv" structure. | ||
3074 | * hw "hw" structure. | ||
3075 | * macarray New array of MAC addresses. | ||
3076 | * | ||
3077 | * Returns: | ||
3078 | * Nothing | ||
3079 | * | ||
3080 | ----------------------------------------------------------------*/ | ||
3081 | |||
3082 | static void prism2mib_priv_accessallow( | ||
3083 | hfa384x_t *hw, | ||
3084 | p80211macarray_t *macarray) | ||
3085 | { | ||
3086 | prism2sta_authlist_t old; | ||
3087 | int i, j; | ||
3088 | |||
3089 | DBFENTER; | ||
3090 | |||
3091 | /* | ||
3092 | ** Change the access list. Note that the interrupt handler may be in | ||
3093 | ** the middle of using the access list!!! Since the interrupt handler | ||
3094 | ** will always have priority over this process and this is the only | ||
3095 | ** process that will modify the list, this problem can be handled as | ||
3096 | ** follows: | ||
3097 | ** | ||
3098 | ** 1. Set the "modify" flag. | ||
3099 | ** 2. Change the first copy of the list. | ||
3100 | ** 3. Clear the "modify" flag. | ||
3101 | ** 4. Change the backup copy of the list. | ||
3102 | ** | ||
3103 | ** The interrupt handler will check the "modify" flag. If NOT set, then | ||
3104 | ** the first copy of the list is valid and may be used. Otherwise, the | ||
3105 | ** first copy is being changed but the backup copy is valid and may be | ||
3106 | ** used. Doing things this way prevents having to have the interrupt | ||
3107 | ** handler block while the list is being updated. | ||
3108 | */ | ||
3109 | |||
3110 | hw->allow.modify = 1; | ||
3111 | |||
3112 | hw->allow.cnt = macarray->cnt; | ||
3113 | memcpy(hw->allow.addr, macarray->data, macarray->cnt*WLAN_ADDR_LEN); | ||
3114 | |||
3115 | hw->allow.modify = 0; | ||
3116 | |||
3117 | hw->allow.cnt1 = macarray->cnt; | ||
3118 | memcpy(hw->allow.addr1, macarray->data, macarray->cnt*WLAN_ADDR_LEN); | ||
3119 | |||
3120 | /* | ||
3121 | ** If the current access mode is "Allow", then changing the access | ||
3122 | ** list may leave some stations authenticated which should not be | ||
3123 | ** authenticated. It will be necessary to de-authenticate these | ||
3124 | ** stations. Otherwise, the list can be changed without a lot of fuss. | ||
3125 | */ | ||
3126 | |||
3127 | if (hw->accessmode == WLAN_ACCESS_ALLOW) { | ||
3128 | |||
3129 | /* | ||
3130 | ** Go through the list of authenticated stations (some of | ||
3131 | ** which might de-authenticate themselves while we are | ||
3132 | ** processing it but that is okay). Any station which is | ||
3133 | ** no longer in the list of allowed stations, must be | ||
3134 | ** de-authenticated. | ||
3135 | */ | ||
3136 | |||
3137 | prism2mib_priv_authlist(hw, &old); | ||
3138 | |||
3139 | for (i = 0; i < old.cnt; i++) { | ||
3140 | for (j = 0; j < hw->allow.cnt; j++) | ||
3141 | if (memcmp(old.addr[i], hw->allow.addr[j], | ||
3142 | WLAN_ADDR_LEN) == 0) | ||
3143 | break; | ||
3144 | if (j >= hw->allow.cnt) | ||
3145 | prism2mib_priv_deauthenticate(hw, old.addr[i]); | ||
3146 | } | ||
3147 | } | ||
3148 | |||
3149 | DBFEXIT; | ||
3150 | return; | ||
3151 | } | ||
3152 | |||
3153 | /*---------------------------------------------------------------- | ||
3154 | * prism2mib_priv_accessdeny | ||
3155 | * | ||
3156 | * Change the list of denied MAC addresses. | ||
3157 | * | ||
3158 | * Arguments: | ||
3159 | * priv "priv" structure. | ||
3160 | * hw "hw" structure. | ||
3161 | * macarray New array of MAC addresses. | ||
3162 | * | ||
3163 | * Returns: | ||
3164 | * Nothing | ||
3165 | * | ||
3166 | ----------------------------------------------------------------*/ | ||
3167 | |||
3168 | static void prism2mib_priv_accessdeny( | ||
3169 | hfa384x_t *hw, | ||
3170 | p80211macarray_t *macarray) | ||
3171 | { | ||
3172 | prism2sta_authlist_t old; | ||
3173 | int i, j; | ||
3174 | |||
3175 | DBFENTER; | ||
3176 | |||
3177 | /* | ||
3178 | ** Change the access list. Note that the interrupt handler may be in | ||
3179 | ** the middle of using the access list!!! Since the interrupt handler | ||
3180 | ** will always have priority over this process and this is the only | ||
3181 | ** process that will modify the list, this problem can be handled as | ||
3182 | ** follows: | ||
3183 | ** | ||
3184 | ** 1. Set the "modify" flag. | ||
3185 | ** 2. Change the first copy of the list. | ||
3186 | ** 3. Clear the "modify" flag. | ||
3187 | ** 4. Change the backup copy of the list. | ||
3188 | ** | ||
3189 | ** The interrupt handler will check the "modify" flag. If NOT set, then | ||
3190 | ** the first copy of the list is valid and may be used. Otherwise, the | ||
3191 | ** first copy is being changed but the backup copy is valid and may be | ||
3192 | ** used. Doing things this way prevents having to have the interrupt | ||
3193 | ** handler block while the list is being updated. | ||
3194 | */ | ||
3195 | |||
3196 | hw->deny.modify = 1; | ||
3197 | |||
3198 | hw->deny.cnt = macarray->cnt; | ||
3199 | memcpy(hw->deny.addr, macarray->data, macarray->cnt*WLAN_ADDR_LEN); | ||
3200 | |||
3201 | hw->deny.modify = 0; | ||
3202 | |||
3203 | hw->deny.cnt1 = macarray->cnt; | ||
3204 | memcpy(hw->deny.addr1, macarray->data, macarray->cnt*WLAN_ADDR_LEN); | ||
3205 | |||
3206 | /* | ||
3207 | ** If the current access mode is "Deny", then changing the access | ||
3208 | ** list may leave some stations authenticated which should not be | ||
3209 | ** authenticated. It will be necessary to de-authenticate these | ||
3210 | ** stations. Otherwise, the list can be changed without a lot of fuss. | ||
3211 | */ | ||
3212 | |||
3213 | if (hw->accessmode == WLAN_ACCESS_DENY) { | ||
3214 | |||
3215 | /* | ||
3216 | ** Go through the list of authenticated stations (some of | ||
3217 | ** which might de-authenticate themselves while we are | ||
3218 | ** processing it but that is okay). Any station which is | ||
3219 | ** now in the list of denied stations, must be de-authenticated. | ||
3220 | */ | ||
3221 | |||
3222 | prism2mib_priv_authlist(hw, &old); | ||
3223 | |||
3224 | for (i = 0; i < old.cnt; i++) | ||
3225 | for (j = 0; j < hw->deny.cnt; j++) | ||
3226 | if (memcmp(old.addr[i], hw->deny.addr[j], | ||
3227 | WLAN_ADDR_LEN) == 0) { | ||
3228 | prism2mib_priv_deauthenticate(hw, old.addr[i]); | ||
3229 | break; | ||
3230 | } | ||
3231 | } | ||
3232 | |||
3233 | DBFEXIT; | ||
3234 | return; | ||
3235 | } | ||
3236 | |||
3237 | /*---------------------------------------------------------------- | ||
3238 | * prism2mib_priv_deauthenticate | ||
3239 | * | ||
3240 | * De-authenticate a station. This is done by sending a HandoverAddress | ||
3241 | * information frame to the firmware. This should work, according to | ||
3242 | * Intersil. | ||
3243 | * | ||
3244 | * Arguments: | ||
3245 | * priv "priv" structure. | ||
3246 | * hw "hw" structure. | ||
3247 | * addr MAC address of station to be de-authenticated. | ||
3248 | * | ||
3249 | * Returns: | ||
3250 | * Nothing | ||
3251 | * | ||
3252 | ----------------------------------------------------------------*/ | ||
3253 | |||
3254 | static void prism2mib_priv_deauthenticate( | ||
3255 | hfa384x_t *hw, | ||
3256 | UINT8 *addr) | ||
3257 | { | ||
3258 | DBFENTER; | ||
3259 | hfa384x_drvr_handover(hw, addr); | ||
3260 | DBFEXIT; | ||
3261 | return; | ||
3262 | } | ||
3263 | |||
3264 | |||
3265 | /*---------------------------------------------------------------- | ||
3266 | * prism2mgmt_pstr2bytestr | ||
3267 | * | ||
3268 | * Convert the pstr data in the WLAN message structure into an hfa384x | ||
3269 | * byte string format. | ||
3270 | * | ||
3271 | * Arguments: | ||
3272 | * bytestr hfa384x byte string data type | ||
3273 | * pstr wlan message data | ||
3274 | * | ||
3275 | * Returns: | ||
3276 | * Nothing | ||
3277 | * | ||
3278 | ----------------------------------------------------------------*/ | ||
3279 | |||
3280 | void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) | ||
3281 | { | ||
3282 | DBFENTER; | ||
3283 | |||
3284 | bytestr->len = host2hfa384x_16((UINT16)(pstr->len)); | ||
3285 | memcpy(bytestr->data, pstr->data, pstr->len); | ||
3286 | DBFEXIT; | ||
3287 | } | ||
3288 | |||
3289 | |||
3290 | /*---------------------------------------------------------------- | ||
3291 | * prism2mgmt_pstr2bytearea | ||
3292 | * | ||
3293 | * Convert the pstr data in the WLAN message structure into an hfa384x | ||
3294 | * byte area format. | ||
3295 | * | ||
3296 | * Arguments: | ||
3297 | * bytearea hfa384x byte area data type | ||
3298 | * pstr wlan message data | ||
3299 | * | ||
3300 | * Returns: | ||
3301 | * Nothing | ||
3302 | * | ||
3303 | ----------------------------------------------------------------*/ | ||
3304 | |||
3305 | void prism2mgmt_pstr2bytearea(UINT8 *bytearea, p80211pstrd_t *pstr) | ||
3306 | { | ||
3307 | DBFENTER; | ||
3308 | |||
3309 | memcpy(bytearea, pstr->data, pstr->len); | ||
3310 | DBFEXIT; | ||
3311 | } | ||
3312 | |||
3313 | |||
3314 | /*---------------------------------------------------------------- | ||
3315 | * prism2mgmt_bytestr2pstr | ||
3316 | * | ||
3317 | * Convert the data in an hfa384x byte string format into a | ||
3318 | * pstr in the WLAN message. | ||
3319 | * | ||
3320 | * Arguments: | ||
3321 | * bytestr hfa384x byte string data type | ||
3322 | * msg wlan message | ||
3323 | * | ||
3324 | * Returns: | ||
3325 | * Nothing | ||
3326 | * | ||
3327 | ----------------------------------------------------------------*/ | ||
3328 | |||
3329 | void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) | ||
3330 | { | ||
3331 | DBFENTER; | ||
3332 | |||
3333 | pstr->len = (UINT8)(hfa384x2host_16((UINT16)(bytestr->len))); | ||
3334 | memcpy(pstr->data, bytestr->data, pstr->len); | ||
3335 | DBFEXIT; | ||
3336 | } | ||
3337 | |||
3338 | |||
3339 | /*---------------------------------------------------------------- | ||
3340 | * prism2mgmt_bytearea2pstr | ||
3341 | * | ||
3342 | * Convert the data in an hfa384x byte area format into a pstr | ||
3343 | * in the WLAN message. | ||
3344 | * | ||
3345 | * Arguments: | ||
3346 | * bytearea hfa384x byte area data type | ||
3347 | * msg wlan message | ||
3348 | * | ||
3349 | * Returns: | ||
3350 | * Nothing | ||
3351 | * | ||
3352 | ----------------------------------------------------------------*/ | ||
3353 | |||
3354 | void prism2mgmt_bytearea2pstr(UINT8 *bytearea, p80211pstrd_t *pstr, int len) | ||
3355 | { | ||
3356 | DBFENTER; | ||
3357 | |||
3358 | pstr->len = (UINT8)len; | ||
3359 | memcpy(pstr->data, bytearea, len); | ||
3360 | DBFEXIT; | ||
3361 | } | ||
3362 | |||
3363 | |||
3364 | /*---------------------------------------------------------------- | ||
3365 | * prism2mgmt_prism2int2p80211int | ||
3366 | * | ||
3367 | * Convert an hfa384x integer into a wlan integer | ||
3368 | * | ||
3369 | * Arguments: | ||
3370 | * prism2enum pointer to hfa384x integer | ||
3371 | * wlanenum pointer to p80211 integer | ||
3372 | * | ||
3373 | * Returns: | ||
3374 | * Nothing | ||
3375 | * | ||
3376 | ----------------------------------------------------------------*/ | ||
3377 | |||
3378 | void prism2mgmt_prism2int2p80211int(UINT16 *prism2int, UINT32 *wlanint) | ||
3379 | { | ||
3380 | DBFENTER; | ||
3381 | |||
3382 | *wlanint = (UINT32)hfa384x2host_16(*prism2int); | ||
3383 | DBFEXIT; | ||
3384 | } | ||
3385 | |||
3386 | |||
3387 | /*---------------------------------------------------------------- | ||
3388 | * prism2mgmt_p80211int2prism2int | ||
3389 | * | ||
3390 | * Convert a wlan integer into an hfa384x integer | ||
3391 | * | ||
3392 | * Arguments: | ||
3393 | * prism2enum pointer to hfa384x integer | ||
3394 | * wlanenum pointer to p80211 integer | ||
3395 | * | ||
3396 | * Returns: | ||
3397 | * Nothing | ||
3398 | * | ||
3399 | ----------------------------------------------------------------*/ | ||
3400 | |||
3401 | void prism2mgmt_p80211int2prism2int(UINT16 *prism2int, UINT32 *wlanint) | ||
3402 | { | ||
3403 | DBFENTER; | ||
3404 | |||
3405 | *prism2int = host2hfa384x_16((UINT16)(*wlanint)); | ||
3406 | DBFEXIT; | ||
3407 | } | ||
3408 | |||
3409 | |||
3410 | /*---------------------------------------------------------------- | ||
3411 | * prism2mgmt_prism2enum2p80211enum | ||
3412 | * | ||
3413 | * Convert the hfa384x enumerated int into a p80211 enumerated int | ||
3414 | * | ||
3415 | * Arguments: | ||
3416 | * prism2enum pointer to hfa384x integer | ||
3417 | * wlanenum pointer to p80211 integer | ||
3418 | * rid hfa384x record id | ||
3419 | * | ||
3420 | * Returns: | ||
3421 | * Nothing | ||
3422 | * | ||
3423 | ----------------------------------------------------------------*/ | ||
3424 | void prism2mgmt_prism2enum2p80211enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid) | ||
3425 | { | ||
3426 | DBFENTER; | ||
3427 | |||
3428 | /* At the moment, the need for this functionality hasn't | ||
3429 | presented itself. All the wlan enumerated values are | ||
3430 | a 1-to-1 match against the Prism2 enumerated values*/ | ||
3431 | DBFEXIT; | ||
3432 | return; | ||
3433 | } | ||
3434 | |||
3435 | |||
3436 | /*---------------------------------------------------------------- | ||
3437 | * prism2mgmt_p80211enum2prism2enum | ||
3438 | * | ||
3439 | * Convert the p80211 enumerated int into an hfa384x enumerated int | ||
3440 | * | ||
3441 | * Arguments: | ||
3442 | * prism2enum pointer to hfa384x integer | ||
3443 | * wlanenum pointer to p80211 integer | ||
3444 | * rid hfa384x record id | ||
3445 | * | ||
3446 | * Returns: | ||
3447 | * Nothing | ||
3448 | * | ||
3449 | ----------------------------------------------------------------*/ | ||
3450 | void prism2mgmt_p80211enum2prism2enum(UINT16 *prism2enum, UINT32 *wlanenum, UINT16 rid) | ||
3451 | { | ||
3452 | DBFENTER; | ||
3453 | |||
3454 | /* At the moment, the need for this functionality hasn't | ||
3455 | presented itself. All the wlan enumerated values are | ||
3456 | a 1-to-1 match against the Prism2 enumerated values*/ | ||
3457 | DBFEXIT; | ||
3458 | return; | ||
3459 | } | ||
3460 | |||
3461 | |||
3462 | |||
3463 | /*---------------------------------------------------------------- | ||
3464 | * prism2mgmt_get_oprateset | ||
3465 | * | ||
3466 | * Convert the hfa384x bit area into a wlan octet string. | ||
3467 | * | ||
3468 | * Arguments: | ||
3469 | * rate Prism2 bit area | ||
3470 | * pstr wlan octet string | ||
3471 | * | ||
3472 | * Returns: | ||
3473 | * Nothing | ||
3474 | * | ||
3475 | ----------------------------------------------------------------*/ | ||
3476 | void prism2mgmt_get_oprateset(UINT16 *rate, p80211pstrd_t *pstr) | ||
3477 | { | ||
3478 | UINT8 len; | ||
3479 | UINT8 *datarate; | ||
3480 | |||
3481 | DBFENTER; | ||
3482 | |||
3483 | len = 0; | ||
3484 | datarate = pstr->data; | ||
3485 | |||
3486 | /* 1 Mbps */ | ||
3487 | if ( BIT0 & (*rate) ) { | ||
3488 | len += (UINT8)1; | ||
3489 | *datarate = (UINT8)2; | ||
3490 | datarate++; | ||
3491 | } | ||
3492 | |||
3493 | /* 2 Mbps */ | ||
3494 | if ( BIT1 & (*rate) ) { | ||
3495 | len += (UINT8)1; | ||
3496 | *datarate = (UINT8)4; | ||
3497 | datarate++; | ||
3498 | } | ||
3499 | |||
3500 | /* 5.5 Mbps */ | ||
3501 | if ( BIT2 & (*rate) ) { | ||
3502 | len += (UINT8)1; | ||
3503 | *datarate = (UINT8)11; | ||
3504 | datarate++; | ||
3505 | } | ||
3506 | |||
3507 | /* 11 Mbps */ | ||
3508 | if ( BIT3 & (*rate) ) { | ||
3509 | len += (UINT8)1; | ||
3510 | *datarate = (UINT8)22; | ||
3511 | datarate++; | ||
3512 | } | ||
3513 | |||
3514 | pstr->len = len; | ||
3515 | |||
3516 | DBFEXIT; | ||
3517 | return; | ||
3518 | } | ||
3519 | |||
3520 | |||
3521 | |||
3522 | /*---------------------------------------------------------------- | ||
3523 | * prism2mgmt_set_oprateset | ||
3524 | * | ||
3525 | * Convert the wlan octet string into an hfa384x bit area. | ||
3526 | * | ||
3527 | * Arguments: | ||
3528 | * rate Prism2 bit area | ||
3529 | * pstr wlan octet string | ||
3530 | * | ||
3531 | * Returns: | ||
3532 | * Nothing | ||
3533 | * | ||
3534 | ----------------------------------------------------------------*/ | ||
3535 | void prism2mgmt_set_oprateset(UINT16 *rate, p80211pstrd_t *pstr) | ||
3536 | { | ||
3537 | UINT8 *datarate; | ||
3538 | int i; | ||
3539 | |||
3540 | DBFENTER; | ||
3541 | |||
3542 | *rate = 0; | ||
3543 | |||
3544 | datarate = pstr->data; | ||
3545 | |||
3546 | for ( i=0; i < pstr->len; i++, datarate++ ) { | ||
3547 | switch (*datarate) { | ||
3548 | case 2: /* 1 Mbps */ | ||
3549 | *rate |= BIT0; | ||
3550 | break; | ||
3551 | case 4: /* 2 Mbps */ | ||
3552 | *rate |= BIT1; | ||
3553 | break; | ||
3554 | case 11: /* 5.5 Mbps */ | ||
3555 | *rate |= BIT2; | ||
3556 | break; | ||
3557 | case 22: /* 11 Mbps */ | ||
3558 | *rate |= BIT3; | ||
3559 | break; | ||
3560 | default: | ||
3561 | WLAN_LOG_DEBUG(1, "Unrecoginzed Rate of %d\n", | ||
3562 | *datarate); | ||
3563 | break; | ||
3564 | } | ||
3565 | } | ||
3566 | |||
3567 | DBFEXIT; | ||
3568 | return; | ||
3569 | } | ||
3570 | |||
3571 | |||
3572 | |||
3573 | /*---------------------------------------------------------------- | ||
3574 | * prism2mgmt_get_grpaddr | ||
3575 | * | ||
3576 | * Retrieves a particular group address from the list of | ||
3577 | * group addresses. | ||
3578 | * | ||
3579 | * Arguments: | ||
3580 | * did mibitem did | ||
3581 | * pstr wlan octet string | ||
3582 | * priv prism2 driver private data structure | ||
3583 | * | ||
3584 | * Returns: | ||
3585 | * Nothing | ||
3586 | * | ||
3587 | ----------------------------------------------------------------*/ | ||
3588 | void prism2mgmt_get_grpaddr(UINT32 did, p80211pstrd_t *pstr, | ||
3589 | hfa384x_t *hw ) | ||
3590 | { | ||
3591 | int index; | ||
3592 | |||
3593 | DBFENTER; | ||
3594 | |||
3595 | index = prism2mgmt_get_grpaddr_index(did); | ||
3596 | |||
3597 | if ( index >= 0 ) { | ||
3598 | pstr->len = WLAN_ADDR_LEN; | ||
3599 | memcpy(pstr->data, hw->dot11_grp_addr[index], | ||
3600 | WLAN_ADDR_LEN); | ||
3601 | } | ||
3602 | |||
3603 | DBFEXIT; | ||
3604 | return; | ||
3605 | } | ||
3606 | |||
3607 | |||
3608 | |||
3609 | /*---------------------------------------------------------------- | ||
3610 | * prism2mgmt_set_grpaddr | ||
3611 | * | ||
3612 | * Convert the wlan octet string into an hfa384x bit area. | ||
3613 | * | ||
3614 | * Arguments: | ||
3615 | * did mibitem did | ||
3616 | * buf | ||
3617 | * groups | ||
3618 | * | ||
3619 | * Returns: | ||
3620 | * 0 Success | ||
3621 | * !0 Error | ||
3622 | * | ||
3623 | ----------------------------------------------------------------*/ | ||
3624 | int prism2mgmt_set_grpaddr(UINT32 did, UINT8 *prism2buf, | ||
3625 | p80211pstrd_t *pstr, hfa384x_t *hw ) | ||
3626 | { | ||
3627 | UINT8 no_addr[WLAN_ADDR_LEN]; | ||
3628 | int index; | ||
3629 | |||
3630 | DBFENTER; | ||
3631 | |||
3632 | memset(no_addr, 0, WLAN_ADDR_LEN); | ||
3633 | if (memcmp(no_addr, pstr->data, WLAN_ADDR_LEN) != 0) { | ||
3634 | |||
3635 | /* | ||
3636 | ** The address is NOT 0 so we are "adding" an address to the | ||
3637 | ** group address list. Check to make sure we aren't trying | ||
3638 | ** to add more than the maximum allowed number of group | ||
3639 | ** addresses in the list. The new address is added to the | ||
3640 | ** end of the list regardless of the DID used to add the | ||
3641 | ** address. | ||
3642 | */ | ||
3643 | |||
3644 | if (hw->dot11_grpcnt >= MAX_GRP_ADDR) return(-1); | ||
3645 | |||
3646 | memcpy(hw->dot11_grp_addr[hw->dot11_grpcnt], pstr->data, | ||
3647 | WLAN_ADDR_LEN); | ||
3648 | hw->dot11_grpcnt += 1; | ||
3649 | } else { | ||
3650 | |||
3651 | /* | ||
3652 | ** The address is 0. Interpret this as "deleting" an address | ||
3653 | ** from the group address list. Get the address index from | ||
3654 | ** the DID. If this is within the range of used addresses, | ||
3655 | ** then delete the specified address by shifting all following | ||
3656 | ** addresses down. Then clear the last address (which should | ||
3657 | ** now be unused). If the address index is NOT within the | ||
3658 | ** range of used addresses, then just ignore the address. | ||
3659 | */ | ||
3660 | |||
3661 | index = prism2mgmt_get_grpaddr_index(did); | ||
3662 | if (index >= 0 && index < hw->dot11_grpcnt) { | ||
3663 | hw->dot11_grpcnt -= 1; | ||
3664 | memmove(hw->dot11_grp_addr[index], | ||
3665 | hw->dot11_grp_addr[index + 1], | ||
3666 | ((hw->dot11_grpcnt)-index) * WLAN_ADDR_LEN); | ||
3667 | memset(hw->dot11_grp_addr[hw->dot11_grpcnt], 0, | ||
3668 | WLAN_ADDR_LEN); | ||
3669 | } | ||
3670 | } | ||
3671 | |||
3672 | DBFEXIT; | ||
3673 | return(0); | ||
3674 | } | ||
3675 | |||
3676 | |||
3677 | /*---------------------------------------------------------------- | ||
3678 | * prism2mgmt_get_grpaddr_index | ||
3679 | * | ||
3680 | * Gets the index in the group address list based on the did. | ||
3681 | * | ||
3682 | * Arguments: | ||
3683 | * did mibitem did | ||
3684 | * | ||
3685 | * Returns: | ||
3686 | * >= 0 If valid did | ||
3687 | * < 0 If not valid did | ||
3688 | * | ||
3689 | ----------------------------------------------------------------*/ | ||
3690 | int prism2mgmt_get_grpaddr_index( UINT32 did ) | ||
3691 | { | ||
3692 | int index; | ||
3693 | |||
3694 | DBFENTER; | ||
3695 | |||
3696 | index = -1; | ||
3697 | |||
3698 | switch (did) { | ||
3699 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address1: | ||
3700 | index = 0; | ||
3701 | break; | ||
3702 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address2: | ||
3703 | index = 1; | ||
3704 | break; | ||
3705 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address3: | ||
3706 | index = 2; | ||
3707 | break; | ||
3708 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address4: | ||
3709 | index = 3; | ||
3710 | break; | ||
3711 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address5: | ||
3712 | index = 4; | ||
3713 | break; | ||
3714 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address6: | ||
3715 | index = 5; | ||
3716 | break; | ||
3717 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address7: | ||
3718 | index = 6; | ||
3719 | break; | ||
3720 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address8: | ||
3721 | index = 7; | ||
3722 | break; | ||
3723 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address9: | ||
3724 | index = 8; | ||
3725 | break; | ||
3726 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address10: | ||
3727 | index = 9; | ||
3728 | break; | ||
3729 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address11: | ||
3730 | index = 10; | ||
3731 | break; | ||
3732 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address12: | ||
3733 | index = 11; | ||
3734 | break; | ||
3735 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address13: | ||
3736 | index = 12; | ||
3737 | break; | ||
3738 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address14: | ||
3739 | index = 13; | ||
3740 | break; | ||
3741 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address15: | ||
3742 | index = 14; | ||
3743 | break; | ||
3744 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address16: | ||
3745 | index = 15; | ||
3746 | break; | ||
3747 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address17: | ||
3748 | index = 16; | ||
3749 | break; | ||
3750 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address18: | ||
3751 | index = 17; | ||
3752 | break; | ||
3753 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address19: | ||
3754 | index = 18; | ||
3755 | break; | ||
3756 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address20: | ||
3757 | index = 19; | ||
3758 | break; | ||
3759 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address21: | ||
3760 | index = 20; | ||
3761 | break; | ||
3762 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address22: | ||
3763 | index = 21; | ||
3764 | break; | ||
3765 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address23: | ||
3766 | index = 22; | ||
3767 | break; | ||
3768 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address24: | ||
3769 | index = 23; | ||
3770 | break; | ||
3771 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address25: | ||
3772 | index = 24; | ||
3773 | break; | ||
3774 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address26: | ||
3775 | index = 25; | ||
3776 | break; | ||
3777 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address27: | ||
3778 | index = 26; | ||
3779 | break; | ||
3780 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address28: | ||
3781 | index = 27; | ||
3782 | break; | ||
3783 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address29: | ||
3784 | index = 28; | ||
3785 | break; | ||
3786 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address30: | ||
3787 | index = 29; | ||
3788 | break; | ||
3789 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address31: | ||
3790 | index = 30; | ||
3791 | break; | ||
3792 | case DIDmib_dot11mac_dot11GroupAddressesTable_dot11Address32: | ||
3793 | index = 31; | ||
3794 | break; | ||
3795 | } | ||
3796 | |||
3797 | DBFEXIT; | ||
3798 | return index; | ||
3799 | } | ||
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c new file mode 100644 index 000000000000..18aa15f9e417 --- /dev/null +++ b/drivers/staging/wlan-ng/prism2sta.c | |||
@@ -0,0 +1,2502 @@ | |||
1 | /* src/prism2/driver/prism2sta.c | ||
2 | * | ||
3 | * Implements the station functionality for prism2 | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | * | ||
47 | * This file implements the module and linux pcmcia routines for the | ||
48 | * prism2 driver. | ||
49 | * | ||
50 | * -------------------------------------------------------------------- | ||
51 | */ | ||
52 | |||
53 | /*================================================================*/ | ||
54 | /* System Includes */ | ||
55 | #define WLAN_DBVAR prism2_debug | ||
56 | |||
57 | #include "version.h" | ||
58 | |||
59 | |||
60 | #include <linux/version.h> | ||
61 | |||
62 | #include <linux/module.h> | ||
63 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,25)) | ||
64 | #include <linux/moduleparam.h> | ||
65 | #endif | ||
66 | |||
67 | #include <linux/kernel.h> | ||
68 | #include <linux/sched.h> | ||
69 | #include <linux/types.h> | ||
70 | #include <linux/init.h> | ||
71 | #include <linux/slab.h> | ||
72 | #include <linux/wireless.h> | ||
73 | #include <linux/netdevice.h> | ||
74 | |||
75 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
76 | #include <linux/tqueue.h> | ||
77 | #else | ||
78 | #include <linux/workqueue.h> | ||
79 | #endif | ||
80 | |||
81 | #include <asm/io.h> | ||
82 | #include <linux/delay.h> | ||
83 | #include <asm/byteorder.h> | ||
84 | #include <linux/if_arp.h> | ||
85 | |||
86 | #if (WLAN_HOSTIF == WLAN_PCMCIA) | ||
87 | #include <pcmcia/version.h> | ||
88 | #include <pcmcia/cs_types.h> | ||
89 | #include <pcmcia/cs.h> | ||
90 | #include <pcmcia/cistpl.h> | ||
91 | #include <pcmcia/ds.h> | ||
92 | #include <pcmcia/cisreg.h> | ||
93 | #endif | ||
94 | |||
95 | #include "wlan_compat.h" | ||
96 | |||
97 | #if ((WLAN_HOSTIF == WLAN_PLX) || (WLAN_HOSTIF == WLAN_PCI)) | ||
98 | #include <linux/ioport.h> | ||
99 | #include <linux/pci.h> | ||
100 | #endif | ||
101 | |||
102 | /*================================================================*/ | ||
103 | /* Project Includes */ | ||
104 | |||
105 | #include "p80211types.h" | ||
106 | #include "p80211hdr.h" | ||
107 | #include "p80211mgmt.h" | ||
108 | #include "p80211conv.h" | ||
109 | #include "p80211msg.h" | ||
110 | #include "p80211netdev.h" | ||
111 | #include "p80211req.h" | ||
112 | #include "p80211metadef.h" | ||
113 | #include "p80211metastruct.h" | ||
114 | #include "hfa384x.h" | ||
115 | #include "prism2mgmt.h" | ||
116 | |||
117 | /*================================================================*/ | ||
118 | /* Local Constants */ | ||
119 | |||
120 | /*================================================================*/ | ||
121 | /* Local Macros */ | ||
122 | |||
123 | /*================================================================*/ | ||
124 | /* Local Types */ | ||
125 | |||
126 | /*================================================================*/ | ||
127 | /* Local Static Definitions */ | ||
128 | |||
129 | #if (WLAN_HOSTIF == WLAN_PCMCIA) | ||
130 | #define DRIVER_SUFFIX "_cs" | ||
131 | #elif (WLAN_HOSTIF == WLAN_PLX) | ||
132 | #define DRIVER_SUFFIX "_plx" | ||
133 | typedef char* dev_info_t; | ||
134 | #elif (WLAN_HOSTIF == WLAN_PCI) | ||
135 | #define DRIVER_SUFFIX "_pci" | ||
136 | typedef char* dev_info_t; | ||
137 | #elif (WLAN_HOSTIF == WLAN_USB) | ||
138 | #define DRIVER_SUFFIX "_usb" | ||
139 | typedef char* dev_info_t; | ||
140 | #else | ||
141 | #error "HOSTIF unsupported or undefined!" | ||
142 | #endif | ||
143 | |||
144 | static char *version = "prism2" DRIVER_SUFFIX ".o: " WLAN_RELEASE; | ||
145 | static dev_info_t dev_info = "prism2" DRIVER_SUFFIX; | ||
146 | |||
147 | #if (WLAN_HOSTIF == WLAN_PLX || WLAN_HOSTIF == WLAN_PCI) | ||
148 | #ifdef CONFIG_PM | ||
149 | static int prism2sta_suspend_pci(struct pci_dev *pdev, pm_message_t state); | ||
150 | static int prism2sta_resume_pci(struct pci_dev *pdev); | ||
151 | #endif | ||
152 | #endif | ||
153 | |||
154 | #if (WLAN_HOSTIF == WLAN_PCI) | ||
155 | |||
156 | #endif /* WLAN_PCI */ | ||
157 | |||
158 | static wlandevice_t *create_wlan(void); | ||
159 | |||
160 | /*----------------------------------------------------------------*/ | ||
161 | /* --Module Parameters */ | ||
162 | |||
163 | int prism2_reset_holdtime=30; /* Reset hold time in ms */ | ||
164 | int prism2_reset_settletime=100; /* Reset settle time in ms */ | ||
165 | |||
166 | #if (WLAN_HOSTIF == WLAN_USB) | ||
167 | static int prism2_doreset=0; /* Do a reset at init? */ | ||
168 | #else | ||
169 | static int prism2_doreset=1; /* Do a reset at init? */ | ||
170 | int prism2_bap_timeout=1000; /* BAP timeout */ | ||
171 | int prism2_irq_evread_max=20; /* Maximum number of | ||
172 | * ev_reads (loops) | ||
173 | * in irq handler | ||
174 | */ | ||
175 | #endif | ||
176 | |||
177 | #ifdef WLAN_INCLUDE_DEBUG | ||
178 | int prism2_debug=0; | ||
179 | module_param( prism2_debug, int, 0644); | ||
180 | MODULE_PARM_DESC(prism2_debug, "prism2 debugging"); | ||
181 | #endif | ||
182 | |||
183 | module_param( prism2_doreset, int, 0644); | ||
184 | MODULE_PARM_DESC(prism2_doreset, "Issue a reset on initialization"); | ||
185 | |||
186 | module_param( prism2_reset_holdtime, int, 0644); | ||
187 | MODULE_PARM_DESC( prism2_reset_holdtime, "reset hold time in ms"); | ||
188 | module_param( prism2_reset_settletime, int, 0644); | ||
189 | MODULE_PARM_DESC( prism2_reset_settletime, "reset settle time in ms"); | ||
190 | |||
191 | #if (WLAN_HOSTIF != WLAN_USB) | ||
192 | module_param( prism2_bap_timeout, int, 0644); | ||
193 | MODULE_PARM_DESC(prism2_bap_timeout, "BufferAccessPath Timeout in 10*n us"); | ||
194 | module_param( prism2_irq_evread_max, int, 0644); | ||
195 | MODULE_PARM_DESC( prism2_irq_evread_max, "Maximim number of event reads in interrupt handler"); | ||
196 | #endif | ||
197 | |||
198 | MODULE_LICENSE("Dual MPL/GPL"); | ||
199 | |||
200 | /*================================================================*/ | ||
201 | /* Local Function Declarations */ | ||
202 | |||
203 | static int prism2sta_open(wlandevice_t *wlandev); | ||
204 | static int prism2sta_close(wlandevice_t *wlandev); | ||
205 | static void prism2sta_reset(wlandevice_t *wlandev ); | ||
206 | static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep); | ||
207 | static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg); | ||
208 | static int prism2sta_getcardinfo(wlandevice_t *wlandev); | ||
209 | static int prism2sta_globalsetup(wlandevice_t *wlandev); | ||
210 | static int prism2sta_setmulticast(wlandevice_t *wlandev, | ||
211 | netdevice_t *dev); | ||
212 | |||
213 | static void prism2sta_inf_handover( | ||
214 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
215 | static void prism2sta_inf_tallies( | ||
216 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
217 | static void prism2sta_inf_hostscanresults( | ||
218 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
219 | static void prism2sta_inf_scanresults( | ||
220 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
221 | static void prism2sta_inf_chinforesults( | ||
222 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
223 | static void prism2sta_inf_linkstatus( | ||
224 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
225 | static void prism2sta_inf_assocstatus( | ||
226 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
227 | static void prism2sta_inf_authreq( | ||
228 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
229 | static void prism2sta_inf_authreq_defer( | ||
230 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
231 | static void prism2sta_inf_psusercnt( | ||
232 | wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); | ||
233 | |||
234 | #ifdef CONFIG_PROC_FS | ||
235 | static int | ||
236 | prism2sta_proc_read( | ||
237 | char *page, | ||
238 | char **start, | ||
239 | off_t offset, | ||
240 | int count, | ||
241 | int *eof, | ||
242 | void *data); | ||
243 | #endif | ||
244 | |||
245 | /*================================================================*/ | ||
246 | /* Function Definitions */ | ||
247 | |||
248 | /*---------------------------------------------------------------- | ||
249 | * dmpmem | ||
250 | * | ||
251 | * Debug utility function to dump memory to the kernel debug log. | ||
252 | * | ||
253 | * Arguments: | ||
254 | * buf ptr data we want dumped | ||
255 | * len length of data | ||
256 | * | ||
257 | * Returns: | ||
258 | * nothing | ||
259 | * Side effects: | ||
260 | * | ||
261 | * Call context: | ||
262 | * process thread | ||
263 | * interrupt | ||
264 | ----------------------------------------------------------------*/ | ||
265 | inline void dmpmem(void *buf, int n) | ||
266 | { | ||
267 | int c; | ||
268 | for ( c= 0; c < n; c++) { | ||
269 | if ( (c % 16) == 0 ) printk(KERN_DEBUG"dmp[%d]: ", c); | ||
270 | printk("%02x ", ((UINT8*)buf)[c]); | ||
271 | if ( (c % 16) == 15 ) printk("\n"); | ||
272 | } | ||
273 | if ( (c % 16) != 0 ) printk("\n"); | ||
274 | } | ||
275 | |||
276 | |||
277 | /*---------------------------------------------------------------- | ||
278 | * prism2sta_open | ||
279 | * | ||
280 | * WLAN device open method. Called from p80211netdev when kernel | ||
281 | * device open (start) method is called in response to the | ||
282 | * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP | ||
283 | * from clear to set. | ||
284 | * | ||
285 | * Arguments: | ||
286 | * wlandev wlan device structure | ||
287 | * | ||
288 | * Returns: | ||
289 | * 0 success | ||
290 | * >0 f/w reported error | ||
291 | * <0 driver reported error | ||
292 | * | ||
293 | * Side effects: | ||
294 | * | ||
295 | * Call context: | ||
296 | * process thread | ||
297 | ----------------------------------------------------------------*/ | ||
298 | static int prism2sta_open(wlandevice_t *wlandev) | ||
299 | { | ||
300 | DBFENTER; | ||
301 | |||
302 | #ifdef ANCIENT_MODULE_CODE | ||
303 | MOD_INC_USE_COUNT; | ||
304 | #endif | ||
305 | |||
306 | /* We don't currently have to do anything else. | ||
307 | * The setup of the MAC should be subsequently completed via | ||
308 | * the mlme commands. | ||
309 | * Higher layers know we're ready from dev->start==1 and | ||
310 | * dev->tbusy==0. Our rx path knows to pass up received/ | ||
311 | * frames because of dev->flags&IFF_UP is true. | ||
312 | */ | ||
313 | |||
314 | DBFEXIT; | ||
315 | return 0; | ||
316 | } | ||
317 | |||
318 | |||
319 | /*---------------------------------------------------------------- | ||
320 | * prism2sta_close | ||
321 | * | ||
322 | * WLAN device close method. Called from p80211netdev when kernel | ||
323 | * device close method is called in response to the | ||
324 | * SIOCSIIFFLAGS ioctl changing the flags bit IFF_UP | ||
325 | * from set to clear. | ||
326 | * | ||
327 | * Arguments: | ||
328 | * wlandev wlan device structure | ||
329 | * | ||
330 | * Returns: | ||
331 | * 0 success | ||
332 | * >0 f/w reported error | ||
333 | * <0 driver reported error | ||
334 | * | ||
335 | * Side effects: | ||
336 | * | ||
337 | * Call context: | ||
338 | * process thread | ||
339 | ----------------------------------------------------------------*/ | ||
340 | static int prism2sta_close(wlandevice_t *wlandev) | ||
341 | { | ||
342 | DBFENTER; | ||
343 | |||
344 | #ifdef ANCIENT_MODULE_CODE | ||
345 | MOD_DEC_USE_COUNT; | ||
346 | #endif | ||
347 | |||
348 | /* We don't currently have to do anything else. | ||
349 | * Higher layers know we're not ready from dev->start==0 and | ||
350 | * dev->tbusy==1. Our rx path knows to not pass up received | ||
351 | * frames because of dev->flags&IFF_UP is false. | ||
352 | */ | ||
353 | |||
354 | DBFEXIT; | ||
355 | return 0; | ||
356 | } | ||
357 | |||
358 | |||
359 | /*---------------------------------------------------------------- | ||
360 | * prism2sta_reset | ||
361 | * | ||
362 | * Not currently implented. | ||
363 | * | ||
364 | * Arguments: | ||
365 | * wlandev wlan device structure | ||
366 | * none | ||
367 | * | ||
368 | * Returns: | ||
369 | * nothing | ||
370 | * | ||
371 | * Side effects: | ||
372 | * | ||
373 | * Call context: | ||
374 | * process thread | ||
375 | ----------------------------------------------------------------*/ | ||
376 | static void prism2sta_reset(wlandevice_t *wlandev ) | ||
377 | { | ||
378 | DBFENTER; | ||
379 | DBFEXIT; | ||
380 | return; | ||
381 | } | ||
382 | |||
383 | |||
384 | /*---------------------------------------------------------------- | ||
385 | * prism2sta_txframe | ||
386 | * | ||
387 | * Takes a frame from p80211 and queues it for transmission. | ||
388 | * | ||
389 | * Arguments: | ||
390 | * wlandev wlan device structure | ||
391 | * pb packet buffer struct. Contains an 802.11 | ||
392 | * data frame. | ||
393 | * p80211_hdr points to the 802.11 header for the packet. | ||
394 | * Returns: | ||
395 | * 0 Success and more buffs available | ||
396 | * 1 Success but no more buffs | ||
397 | * 2 Allocation failure | ||
398 | * 4 Buffer full or queue busy | ||
399 | * | ||
400 | * Side effects: | ||
401 | * | ||
402 | * Call context: | ||
403 | * process thread | ||
404 | ----------------------------------------------------------------*/ | ||
405 | static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, | ||
406 | p80211_hdr_t *p80211_hdr, | ||
407 | p80211_metawep_t *p80211_wep) | ||
408 | { | ||
409 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
410 | int result; | ||
411 | DBFENTER; | ||
412 | |||
413 | /* If necessary, set the 802.11 WEP bit */ | ||
414 | if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) { | ||
415 | p80211_hdr->a3.fc |= host2ieee16(WLAN_SET_FC_ISWEP(1)); | ||
416 | } | ||
417 | |||
418 | result = hfa384x_drvr_txframe(hw, skb, p80211_hdr, p80211_wep); | ||
419 | |||
420 | DBFEXIT; | ||
421 | return result; | ||
422 | } | ||
423 | |||
424 | |||
425 | /*---------------------------------------------------------------- | ||
426 | * prism2sta_mlmerequest | ||
427 | * | ||
428 | * wlan command message handler. All we do here is pass the message | ||
429 | * over to the prism2sta_mgmt_handler. | ||
430 | * | ||
431 | * Arguments: | ||
432 | * wlandev wlan device structure | ||
433 | * msg wlan command message | ||
434 | * Returns: | ||
435 | * 0 success | ||
436 | * <0 successful acceptance of message, but we're | ||
437 | * waiting for an async process to finish before | ||
438 | * we're done with the msg. When the asynch | ||
439 | * process is done, we'll call the p80211 | ||
440 | * function p80211req_confirm() . | ||
441 | * >0 An error occurred while we were handling | ||
442 | * the message. | ||
443 | * | ||
444 | * Side effects: | ||
445 | * | ||
446 | * Call context: | ||
447 | * process thread | ||
448 | ----------------------------------------------------------------*/ | ||
449 | static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg) | ||
450 | { | ||
451 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
452 | |||
453 | int result = 0; | ||
454 | DBFENTER; | ||
455 | |||
456 | switch( msg->msgcode ) | ||
457 | { | ||
458 | case DIDmsg_dot11req_mibget : | ||
459 | WLAN_LOG_DEBUG(2,"Received mibget request\n"); | ||
460 | result = prism2mgmt_mibset_mibget(wlandev, msg); | ||
461 | break; | ||
462 | case DIDmsg_dot11req_mibset : | ||
463 | WLAN_LOG_DEBUG(2,"Received mibset request\n"); | ||
464 | result = prism2mgmt_mibset_mibget(wlandev, msg); | ||
465 | break; | ||
466 | case DIDmsg_dot11req_powermgmt : | ||
467 | WLAN_LOG_DEBUG(2,"Received powermgmt request\n"); | ||
468 | result = prism2mgmt_powermgmt(wlandev, msg); | ||
469 | break; | ||
470 | case DIDmsg_dot11req_scan : | ||
471 | WLAN_LOG_DEBUG(2,"Received scan request\n"); | ||
472 | result = prism2mgmt_scan(wlandev, msg); | ||
473 | break; | ||
474 | case DIDmsg_dot11req_scan_results : | ||
475 | WLAN_LOG_DEBUG(2,"Received scan_results request\n"); | ||
476 | result = prism2mgmt_scan_results(wlandev, msg); | ||
477 | break; | ||
478 | case DIDmsg_dot11req_join : | ||
479 | WLAN_LOG_DEBUG(2,"Received join request\n"); | ||
480 | result = prism2mgmt_join(wlandev, msg); | ||
481 | break; | ||
482 | case DIDmsg_dot11req_authenticate : | ||
483 | WLAN_LOG_DEBUG(2,"Received authenticate request\n"); | ||
484 | result = prism2mgmt_authenticate(wlandev, msg); | ||
485 | break; | ||
486 | case DIDmsg_dot11req_deauthenticate : | ||
487 | WLAN_LOG_DEBUG(2,"Received mlme deauthenticate request\n"); | ||
488 | result = prism2mgmt_deauthenticate(wlandev, msg); | ||
489 | break; | ||
490 | case DIDmsg_dot11req_associate : | ||
491 | WLAN_LOG_DEBUG(2,"Received mlme associate request\n"); | ||
492 | result = prism2mgmt_associate(wlandev, msg); | ||
493 | break; | ||
494 | case DIDmsg_dot11req_reassociate : | ||
495 | WLAN_LOG_DEBUG(2,"Received mlme reassociate request\n"); | ||
496 | result = prism2mgmt_reassociate(wlandev, msg); | ||
497 | break; | ||
498 | case DIDmsg_dot11req_disassociate : | ||
499 | WLAN_LOG_DEBUG(2,"Received mlme disassociate request\n"); | ||
500 | result = prism2mgmt_disassociate(wlandev, msg); | ||
501 | break; | ||
502 | case DIDmsg_dot11req_reset : | ||
503 | WLAN_LOG_DEBUG(2,"Received mlme reset request\n"); | ||
504 | result = prism2mgmt_reset(wlandev, msg); | ||
505 | break; | ||
506 | case DIDmsg_dot11req_start : | ||
507 | WLAN_LOG_DEBUG(2,"Received mlme start request\n"); | ||
508 | result = prism2mgmt_start(wlandev, msg); | ||
509 | break; | ||
510 | /* | ||
511 | * Prism2 specific messages | ||
512 | */ | ||
513 | case DIDmsg_p2req_join : | ||
514 | WLAN_LOG_DEBUG(2,"Received p2 join request\n"); | ||
515 | result = prism2mgmt_p2_join(wlandev, msg); | ||
516 | break; | ||
517 | case DIDmsg_p2req_readpda : | ||
518 | WLAN_LOG_DEBUG(2,"Received mlme readpda request\n"); | ||
519 | result = prism2mgmt_readpda(wlandev, msg); | ||
520 | break; | ||
521 | case DIDmsg_p2req_readcis : | ||
522 | WLAN_LOG_DEBUG(2,"Received mlme readcis request\n"); | ||
523 | result = prism2mgmt_readcis(wlandev, msg); | ||
524 | break; | ||
525 | case DIDmsg_p2req_auxport_state : | ||
526 | WLAN_LOG_DEBUG(2,"Received mlme auxport_state request\n"); | ||
527 | result = prism2mgmt_auxport_state(wlandev, msg); | ||
528 | break; | ||
529 | case DIDmsg_p2req_auxport_read : | ||
530 | WLAN_LOG_DEBUG(2,"Received mlme auxport_read request\n"); | ||
531 | result = prism2mgmt_auxport_read(wlandev, msg); | ||
532 | break; | ||
533 | case DIDmsg_p2req_auxport_write : | ||
534 | WLAN_LOG_DEBUG(2,"Received mlme auxport_write request\n"); | ||
535 | result = prism2mgmt_auxport_write(wlandev, msg); | ||
536 | break; | ||
537 | case DIDmsg_p2req_low_level : | ||
538 | WLAN_LOG_DEBUG(2,"Received mlme low_level request\n"); | ||
539 | result = prism2mgmt_low_level(wlandev, msg); | ||
540 | break; | ||
541 | case DIDmsg_p2req_test_command : | ||
542 | WLAN_LOG_DEBUG(2,"Received mlme test_command request\n"); | ||
543 | result = prism2mgmt_test_command(wlandev, msg); | ||
544 | break; | ||
545 | case DIDmsg_p2req_mmi_read : | ||
546 | WLAN_LOG_DEBUG(2,"Received mlme mmi_read request\n"); | ||
547 | result = prism2mgmt_mmi_read(wlandev, msg); | ||
548 | break; | ||
549 | case DIDmsg_p2req_mmi_write : | ||
550 | WLAN_LOG_DEBUG(2,"Received mlme mmi_write request\n"); | ||
551 | result = prism2mgmt_mmi_write(wlandev, msg); | ||
552 | break; | ||
553 | case DIDmsg_p2req_ramdl_state : | ||
554 | WLAN_LOG_DEBUG(2,"Received mlme ramdl_state request\n"); | ||
555 | result = prism2mgmt_ramdl_state(wlandev, msg); | ||
556 | break; | ||
557 | case DIDmsg_p2req_ramdl_write : | ||
558 | WLAN_LOG_DEBUG(2,"Received mlme ramdl_write request\n"); | ||
559 | result = prism2mgmt_ramdl_write(wlandev, msg); | ||
560 | break; | ||
561 | case DIDmsg_p2req_flashdl_state : | ||
562 | WLAN_LOG_DEBUG(2,"Received mlme flashdl_state request\n"); | ||
563 | result = prism2mgmt_flashdl_state(wlandev, msg); | ||
564 | break; | ||
565 | case DIDmsg_p2req_flashdl_write : | ||
566 | WLAN_LOG_DEBUG(2,"Received mlme flashdl_write request\n"); | ||
567 | result = prism2mgmt_flashdl_write(wlandev, msg); | ||
568 | break; | ||
569 | case DIDmsg_p2req_dump_state : | ||
570 | WLAN_LOG_DEBUG(2,"Received mlme dump_state request\n"); | ||
571 | result = prism2mgmt_dump_state(wlandev, msg); | ||
572 | break; | ||
573 | case DIDmsg_p2req_channel_info : | ||
574 | WLAN_LOG_DEBUG(2,"Received mlme channel_info request\n"); | ||
575 | result = prism2mgmt_channel_info(wlandev, msg); | ||
576 | break; | ||
577 | case DIDmsg_p2req_channel_info_results : | ||
578 | WLAN_LOG_DEBUG(2,"Received mlme channel_info_results request\n"); | ||
579 | result = prism2mgmt_channel_info_results(wlandev, msg); | ||
580 | break; | ||
581 | /* | ||
582 | * Linux specific messages | ||
583 | */ | ||
584 | case DIDmsg_lnxreq_hostwep : | ||
585 | break; // ignore me. | ||
586 | case DIDmsg_lnxreq_ifstate : | ||
587 | { | ||
588 | p80211msg_lnxreq_ifstate_t *ifstatemsg; | ||
589 | WLAN_LOG_DEBUG(2,"Received mlme ifstate request\n"); | ||
590 | ifstatemsg = (p80211msg_lnxreq_ifstate_t*)msg; | ||
591 | result = prism2sta_ifstate(wlandev, ifstatemsg->ifstate.data); | ||
592 | ifstatemsg->resultcode.status = | ||
593 | P80211ENUM_msgitem_status_data_ok; | ||
594 | ifstatemsg->resultcode.data = result; | ||
595 | result = 0; | ||
596 | } | ||
597 | break; | ||
598 | case DIDmsg_lnxreq_wlansniff : | ||
599 | WLAN_LOG_DEBUG(2,"Received mlme wlansniff request\n"); | ||
600 | result = prism2mgmt_wlansniff(wlandev, msg); | ||
601 | break; | ||
602 | case DIDmsg_lnxreq_autojoin : | ||
603 | WLAN_LOG_DEBUG(2,"Received mlme autojoin request\n"); | ||
604 | result = prism2mgmt_autojoin(wlandev, msg); | ||
605 | break; | ||
606 | case DIDmsg_p2req_enable : | ||
607 | WLAN_LOG_DEBUG(2,"Received mlme enable request\n"); | ||
608 | result = prism2mgmt_enable(wlandev, msg); | ||
609 | break; | ||
610 | case DIDmsg_lnxreq_commsquality: { | ||
611 | p80211msg_lnxreq_commsquality_t *qualmsg; | ||
612 | |||
613 | WLAN_LOG_DEBUG(2,"Received commsquality request\n"); | ||
614 | |||
615 | if (hw->ap) | ||
616 | break; | ||
617 | |||
618 | qualmsg = (p80211msg_lnxreq_commsquality_t*) msg; | ||
619 | |||
620 | qualmsg->link.status = P80211ENUM_msgitem_status_data_ok; | ||
621 | qualmsg->level.status = P80211ENUM_msgitem_status_data_ok; | ||
622 | qualmsg->noise.status = P80211ENUM_msgitem_status_data_ok; | ||
623 | |||
624 | |||
625 | qualmsg->link.data = hfa384x2host_16(hw->qual.CQ_currBSS); | ||
626 | qualmsg->level.data = hfa384x2host_16(hw->qual.ASL_currBSS); | ||
627 | qualmsg->noise.data = hfa384x2host_16(hw->qual.ANL_currFC); | ||
628 | |||
629 | break; | ||
630 | } | ||
631 | default: | ||
632 | WLAN_LOG_WARNING("Unknown mgmt request message 0x%08x", msg->msgcode); | ||
633 | break; | ||
634 | } | ||
635 | |||
636 | DBFEXIT; | ||
637 | return result; | ||
638 | } | ||
639 | |||
640 | |||
641 | /*---------------------------------------------------------------- | ||
642 | * prism2sta_ifstate | ||
643 | * | ||
644 | * Interface state. This is the primary WLAN interface enable/disable | ||
645 | * handler. Following the driver/load/deviceprobe sequence, this | ||
646 | * function must be called with a state of "enable" before any other | ||
647 | * commands will be accepted. | ||
648 | * | ||
649 | * Arguments: | ||
650 | * wlandev wlan device structure | ||
651 | * msgp ptr to msg buffer | ||
652 | * | ||
653 | * Returns: | ||
654 | * A p80211 message resultcode value. | ||
655 | * | ||
656 | * Side effects: | ||
657 | * | ||
658 | * Call context: | ||
659 | * process thread (usually) | ||
660 | * interrupt | ||
661 | ----------------------------------------------------------------*/ | ||
662 | UINT32 prism2sta_ifstate(wlandevice_t *wlandev, UINT32 ifstate) | ||
663 | { | ||
664 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
665 | UINT32 result; | ||
666 | DBFENTER; | ||
667 | |||
668 | result = P80211ENUM_resultcode_implementation_failure; | ||
669 | |||
670 | WLAN_LOG_DEBUG(2, "Current MSD state(%d), requesting(%d)\n", | ||
671 | wlandev->msdstate, ifstate); | ||
672 | switch (ifstate) | ||
673 | { | ||
674 | case P80211ENUM_ifstate_fwload: | ||
675 | switch (wlandev->msdstate) { | ||
676 | case WLAN_MSD_HWPRESENT: | ||
677 | wlandev->msdstate = WLAN_MSD_FWLOAD_PENDING; | ||
678 | /* | ||
679 | * Initialize the device+driver sufficiently | ||
680 | * for firmware loading. | ||
681 | */ | ||
682 | #if (WLAN_HOSTIF != WLAN_USB) | ||
683 | result=hfa384x_cmd_initialize(hw); | ||
684 | #else | ||
685 | if ((result=hfa384x_drvr_start(hw))) { | ||
686 | WLAN_LOG_ERROR( | ||
687 | "hfa384x_drvr_start() failed," | ||
688 | "result=%d\n", (int)result); | ||
689 | result = | ||
690 | P80211ENUM_resultcode_implementation_failure; | ||
691 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
692 | break; | ||
693 | } | ||
694 | #endif | ||
695 | wlandev->msdstate = WLAN_MSD_FWLOAD; | ||
696 | result = P80211ENUM_resultcode_success; | ||
697 | break; | ||
698 | case WLAN_MSD_FWLOAD: | ||
699 | hfa384x_cmd_initialize(hw); | ||
700 | result = P80211ENUM_resultcode_success; | ||
701 | break; | ||
702 | case WLAN_MSD_RUNNING: | ||
703 | WLAN_LOG_WARNING( | ||
704 | "Cannot enter fwload state from enable state," | ||
705 | "you must disable first.\n"); | ||
706 | result = P80211ENUM_resultcode_invalid_parameters; | ||
707 | break; | ||
708 | case WLAN_MSD_HWFAIL: | ||
709 | default: | ||
710 | /* probe() had a problem or the msdstate contains | ||
711 | * an unrecognized value, there's nothing we can do. | ||
712 | */ | ||
713 | result = P80211ENUM_resultcode_implementation_failure; | ||
714 | break; | ||
715 | } | ||
716 | break; | ||
717 | case P80211ENUM_ifstate_enable: | ||
718 | switch (wlandev->msdstate) { | ||
719 | case WLAN_MSD_HWPRESENT: | ||
720 | case WLAN_MSD_FWLOAD: | ||
721 | wlandev->msdstate = WLAN_MSD_RUNNING_PENDING; | ||
722 | /* Initialize the device+driver for full | ||
723 | * operation. Note that this might me an FWLOAD to | ||
724 | * to RUNNING transition so we must not do a chip | ||
725 | * or board level reset. Note that on failure, | ||
726 | * the MSD state is set to HWPRESENT because we | ||
727 | * can't make any assumptions about the state | ||
728 | * of the hardware or a previous firmware load. | ||
729 | */ | ||
730 | if ((result=hfa384x_drvr_start(hw))) { | ||
731 | WLAN_LOG_ERROR( | ||
732 | "hfa384x_drvr_start() failed," | ||
733 | "result=%d\n", (int)result); | ||
734 | result = | ||
735 | P80211ENUM_resultcode_implementation_failure; | ||
736 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
737 | break; | ||
738 | } | ||
739 | |||
740 | if ((result=prism2sta_getcardinfo(wlandev))) { | ||
741 | WLAN_LOG_ERROR( | ||
742 | "prism2sta_getcardinfo() failed," | ||
743 | "result=%d\n", (int)result); | ||
744 | result = | ||
745 | P80211ENUM_resultcode_implementation_failure; | ||
746 | hfa384x_drvr_stop(hw); | ||
747 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
748 | break; | ||
749 | } | ||
750 | if ((result=prism2sta_globalsetup(wlandev))) { | ||
751 | WLAN_LOG_ERROR( | ||
752 | "prism2sta_globalsetup() failed," | ||
753 | "result=%d\n", (int)result); | ||
754 | result = | ||
755 | P80211ENUM_resultcode_implementation_failure; | ||
756 | hfa384x_drvr_stop(hw); | ||
757 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
758 | break; | ||
759 | } | ||
760 | wlandev->msdstate = WLAN_MSD_RUNNING; | ||
761 | hw->join_ap = 0; | ||
762 | hw->join_retries = 60; | ||
763 | result = P80211ENUM_resultcode_success; | ||
764 | break; | ||
765 | case WLAN_MSD_RUNNING: | ||
766 | /* Do nothing, we're already in this state.*/ | ||
767 | result = P80211ENUM_resultcode_success; | ||
768 | break; | ||
769 | case WLAN_MSD_HWFAIL: | ||
770 | default: | ||
771 | /* probe() had a problem or the msdstate contains | ||
772 | * an unrecognized value, there's nothing we can do. | ||
773 | */ | ||
774 | result = P80211ENUM_resultcode_implementation_failure; | ||
775 | break; | ||
776 | } | ||
777 | break; | ||
778 | case P80211ENUM_ifstate_disable: | ||
779 | switch (wlandev->msdstate) { | ||
780 | case WLAN_MSD_HWPRESENT: | ||
781 | /* Do nothing, we're already in this state.*/ | ||
782 | result = P80211ENUM_resultcode_success; | ||
783 | break; | ||
784 | case WLAN_MSD_FWLOAD: | ||
785 | case WLAN_MSD_RUNNING: | ||
786 | wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; | ||
787 | /* | ||
788 | * TODO: Shut down the MAC completely. Here a chip | ||
789 | * or board level reset is probably called for. | ||
790 | * After a "disable" _all_ results are lost, even | ||
791 | * those from a fwload. | ||
792 | */ | ||
793 | if (!wlandev->hwremoved) | ||
794 | netif_carrier_off(wlandev->netdev); | ||
795 | |||
796 | hfa384x_drvr_stop(hw); | ||
797 | |||
798 | wlandev->macmode = WLAN_MACMODE_NONE; | ||
799 | wlandev->msdstate = WLAN_MSD_HWPRESENT; | ||
800 | result = P80211ENUM_resultcode_success; | ||
801 | break; | ||
802 | case WLAN_MSD_HWFAIL: | ||
803 | default: | ||
804 | /* probe() had a problem or the msdstate contains | ||
805 | * an unrecognized value, there's nothing we can do. | ||
806 | */ | ||
807 | result = P80211ENUM_resultcode_implementation_failure; | ||
808 | break; | ||
809 | } | ||
810 | break; | ||
811 | default: | ||
812 | result = P80211ENUM_resultcode_invalid_parameters; | ||
813 | break; | ||
814 | } | ||
815 | |||
816 | DBFEXIT; | ||
817 | return result; | ||
818 | } | ||
819 | |||
820 | |||
821 | /*---------------------------------------------------------------- | ||
822 | * prism2sta_getcardinfo | ||
823 | * | ||
824 | * Collect the NICID, firmware version and any other identifiers | ||
825 | * we'd like to have in host-side data structures. | ||
826 | * | ||
827 | * Arguments: | ||
828 | * wlandev wlan device structure | ||
829 | * | ||
830 | * Returns: | ||
831 | * 0 success | ||
832 | * >0 f/w reported error | ||
833 | * <0 driver reported error | ||
834 | * | ||
835 | * Side effects: | ||
836 | * | ||
837 | * Call context: | ||
838 | * Either. | ||
839 | ----------------------------------------------------------------*/ | ||
840 | static int prism2sta_getcardinfo(wlandevice_t *wlandev) | ||
841 | { | ||
842 | int result = 0; | ||
843 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
844 | UINT16 temp; | ||
845 | UINT8 snum[HFA384x_RID_NICSERIALNUMBER_LEN]; | ||
846 | char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1]; | ||
847 | |||
848 | DBFENTER; | ||
849 | |||
850 | /* Collect version and compatibility info */ | ||
851 | /* Some are critical, some are not */ | ||
852 | /* NIC identity */ | ||
853 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY, | ||
854 | &hw->ident_nic, sizeof(hfa384x_compident_t)); | ||
855 | if ( result ) { | ||
856 | WLAN_LOG_ERROR("Failed to retrieve NICIDENTITY\n"); | ||
857 | goto failed; | ||
858 | } | ||
859 | |||
860 | /* get all the nic id fields in host byte order */ | ||
861 | hw->ident_nic.id = hfa384x2host_16(hw->ident_nic.id); | ||
862 | hw->ident_nic.variant = hfa384x2host_16(hw->ident_nic.variant); | ||
863 | hw->ident_nic.major = hfa384x2host_16(hw->ident_nic.major); | ||
864 | hw->ident_nic.minor = hfa384x2host_16(hw->ident_nic.minor); | ||
865 | |||
866 | WLAN_LOG_INFO( "ident: nic h/w: id=0x%02x %d.%d.%d\n", | ||
867 | hw->ident_nic.id, hw->ident_nic.major, | ||
868 | hw->ident_nic.minor, hw->ident_nic.variant); | ||
869 | |||
870 | /* Primary f/w identity */ | ||
871 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY, | ||
872 | &hw->ident_pri_fw, sizeof(hfa384x_compident_t)); | ||
873 | if ( result ) { | ||
874 | WLAN_LOG_ERROR("Failed to retrieve PRIIDENTITY\n"); | ||
875 | goto failed; | ||
876 | } | ||
877 | |||
878 | /* get all the private fw id fields in host byte order */ | ||
879 | hw->ident_pri_fw.id = hfa384x2host_16(hw->ident_pri_fw.id); | ||
880 | hw->ident_pri_fw.variant = hfa384x2host_16(hw->ident_pri_fw.variant); | ||
881 | hw->ident_pri_fw.major = hfa384x2host_16(hw->ident_pri_fw.major); | ||
882 | hw->ident_pri_fw.minor = hfa384x2host_16(hw->ident_pri_fw.minor); | ||
883 | |||
884 | WLAN_LOG_INFO( "ident: pri f/w: id=0x%02x %d.%d.%d\n", | ||
885 | hw->ident_pri_fw.id, hw->ident_pri_fw.major, | ||
886 | hw->ident_pri_fw.minor, hw->ident_pri_fw.variant); | ||
887 | |||
888 | /* Station (Secondary?) f/w identity */ | ||
889 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY, | ||
890 | &hw->ident_sta_fw, sizeof(hfa384x_compident_t)); | ||
891 | if ( result ) { | ||
892 | WLAN_LOG_ERROR("Failed to retrieve STAIDENTITY\n"); | ||
893 | goto failed; | ||
894 | } | ||
895 | |||
896 | if (hw->ident_nic.id < 0x8000) { | ||
897 | WLAN_LOG_ERROR("FATAL: Card is not an Intersil Prism2/2.5/3\n"); | ||
898 | result = -1; | ||
899 | goto failed; | ||
900 | } | ||
901 | |||
902 | /* get all the station fw id fields in host byte order */ | ||
903 | hw->ident_sta_fw.id = hfa384x2host_16(hw->ident_sta_fw.id); | ||
904 | hw->ident_sta_fw.variant = hfa384x2host_16(hw->ident_sta_fw.variant); | ||
905 | hw->ident_sta_fw.major = hfa384x2host_16(hw->ident_sta_fw.major); | ||
906 | hw->ident_sta_fw.minor = hfa384x2host_16(hw->ident_sta_fw.minor); | ||
907 | |||
908 | /* strip out the 'special' variant bits */ | ||
909 | hw->mm_mods = hw->ident_sta_fw.variant & (BIT14 | BIT15); | ||
910 | hw->ident_sta_fw.variant &= ~((UINT16)(BIT14 | BIT15)); | ||
911 | |||
912 | if ( hw->ident_sta_fw.id == 0x1f ) { | ||
913 | hw->ap = 0; | ||
914 | WLAN_LOG_INFO( | ||
915 | "ident: sta f/w: id=0x%02x %d.%d.%d\n", | ||
916 | hw->ident_sta_fw.id, hw->ident_sta_fw.major, | ||
917 | hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); | ||
918 | } else { | ||
919 | hw->ap = 1; | ||
920 | WLAN_LOG_INFO( | ||
921 | "ident: ap f/w: id=0x%02x %d.%d.%d\n", | ||
922 | hw->ident_sta_fw.id, hw->ident_sta_fw.major, | ||
923 | hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); | ||
924 | } | ||
925 | |||
926 | /* Compatibility range, Modem supplier */ | ||
927 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE, | ||
928 | &hw->cap_sup_mfi, sizeof(hfa384x_caplevel_t)); | ||
929 | if ( result ) { | ||
930 | WLAN_LOG_ERROR("Failed to retrieve MFISUPRANGE\n"); | ||
931 | goto failed; | ||
932 | } | ||
933 | |||
934 | /* get all the Compatibility range, modem interface supplier | ||
935 | fields in byte order */ | ||
936 | hw->cap_sup_mfi.role = hfa384x2host_16(hw->cap_sup_mfi.role); | ||
937 | hw->cap_sup_mfi.id = hfa384x2host_16(hw->cap_sup_mfi.id); | ||
938 | hw->cap_sup_mfi.variant = hfa384x2host_16(hw->cap_sup_mfi.variant); | ||
939 | hw->cap_sup_mfi.bottom = hfa384x2host_16(hw->cap_sup_mfi.bottom); | ||
940 | hw->cap_sup_mfi.top = hfa384x2host_16(hw->cap_sup_mfi.top); | ||
941 | |||
942 | WLAN_LOG_INFO( | ||
943 | "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
944 | hw->cap_sup_mfi.role, hw->cap_sup_mfi.id, | ||
945 | hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom, | ||
946 | hw->cap_sup_mfi.top); | ||
947 | |||
948 | /* Compatibility range, Controller supplier */ | ||
949 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE, | ||
950 | &hw->cap_sup_cfi, sizeof(hfa384x_caplevel_t)); | ||
951 | if ( result ) { | ||
952 | WLAN_LOG_ERROR("Failed to retrieve CFISUPRANGE\n"); | ||
953 | goto failed; | ||
954 | } | ||
955 | |||
956 | /* get all the Compatibility range, controller interface supplier | ||
957 | fields in byte order */ | ||
958 | hw->cap_sup_cfi.role = hfa384x2host_16(hw->cap_sup_cfi.role); | ||
959 | hw->cap_sup_cfi.id = hfa384x2host_16(hw->cap_sup_cfi.id); | ||
960 | hw->cap_sup_cfi.variant = hfa384x2host_16(hw->cap_sup_cfi.variant); | ||
961 | hw->cap_sup_cfi.bottom = hfa384x2host_16(hw->cap_sup_cfi.bottom); | ||
962 | hw->cap_sup_cfi.top = hfa384x2host_16(hw->cap_sup_cfi.top); | ||
963 | |||
964 | WLAN_LOG_INFO( | ||
965 | "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
966 | hw->cap_sup_cfi.role, hw->cap_sup_cfi.id, | ||
967 | hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom, | ||
968 | hw->cap_sup_cfi.top); | ||
969 | |||
970 | /* Compatibility range, Primary f/w supplier */ | ||
971 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE, | ||
972 | &hw->cap_sup_pri, sizeof(hfa384x_caplevel_t)); | ||
973 | if ( result ) { | ||
974 | WLAN_LOG_ERROR("Failed to retrieve PRISUPRANGE\n"); | ||
975 | goto failed; | ||
976 | } | ||
977 | |||
978 | /* get all the Compatibility range, primary firmware supplier | ||
979 | fields in byte order */ | ||
980 | hw->cap_sup_pri.role = hfa384x2host_16(hw->cap_sup_pri.role); | ||
981 | hw->cap_sup_pri.id = hfa384x2host_16(hw->cap_sup_pri.id); | ||
982 | hw->cap_sup_pri.variant = hfa384x2host_16(hw->cap_sup_pri.variant); | ||
983 | hw->cap_sup_pri.bottom = hfa384x2host_16(hw->cap_sup_pri.bottom); | ||
984 | hw->cap_sup_pri.top = hfa384x2host_16(hw->cap_sup_pri.top); | ||
985 | |||
986 | WLAN_LOG_INFO( | ||
987 | "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
988 | hw->cap_sup_pri.role, hw->cap_sup_pri.id, | ||
989 | hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom, | ||
990 | hw->cap_sup_pri.top); | ||
991 | |||
992 | /* Compatibility range, Station f/w supplier */ | ||
993 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE, | ||
994 | &hw->cap_sup_sta, sizeof(hfa384x_caplevel_t)); | ||
995 | if ( result ) { | ||
996 | WLAN_LOG_ERROR("Failed to retrieve STASUPRANGE\n"); | ||
997 | goto failed; | ||
998 | } | ||
999 | |||
1000 | /* get all the Compatibility range, station firmware supplier | ||
1001 | fields in byte order */ | ||
1002 | hw->cap_sup_sta.role = hfa384x2host_16(hw->cap_sup_sta.role); | ||
1003 | hw->cap_sup_sta.id = hfa384x2host_16(hw->cap_sup_sta.id); | ||
1004 | hw->cap_sup_sta.variant = hfa384x2host_16(hw->cap_sup_sta.variant); | ||
1005 | hw->cap_sup_sta.bottom = hfa384x2host_16(hw->cap_sup_sta.bottom); | ||
1006 | hw->cap_sup_sta.top = hfa384x2host_16(hw->cap_sup_sta.top); | ||
1007 | |||
1008 | if ( hw->cap_sup_sta.id == 0x04 ) { | ||
1009 | WLAN_LOG_INFO( | ||
1010 | "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
1011 | hw->cap_sup_sta.role, hw->cap_sup_sta.id, | ||
1012 | hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, | ||
1013 | hw->cap_sup_sta.top); | ||
1014 | } else { | ||
1015 | WLAN_LOG_INFO( | ||
1016 | "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
1017 | hw->cap_sup_sta.role, hw->cap_sup_sta.id, | ||
1018 | hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, | ||
1019 | hw->cap_sup_sta.top); | ||
1020 | } | ||
1021 | |||
1022 | /* Compatibility range, primary f/w actor, CFI supplier */ | ||
1023 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES, | ||
1024 | &hw->cap_act_pri_cfi, sizeof(hfa384x_caplevel_t)); | ||
1025 | if ( result ) { | ||
1026 | WLAN_LOG_ERROR("Failed to retrieve PRI_CFIACTRANGES\n"); | ||
1027 | goto failed; | ||
1028 | } | ||
1029 | |||
1030 | /* get all the Compatibility range, primary f/w actor, CFI supplier | ||
1031 | fields in byte order */ | ||
1032 | hw->cap_act_pri_cfi.role = hfa384x2host_16(hw->cap_act_pri_cfi.role); | ||
1033 | hw->cap_act_pri_cfi.id = hfa384x2host_16(hw->cap_act_pri_cfi.id); | ||
1034 | hw->cap_act_pri_cfi.variant = hfa384x2host_16(hw->cap_act_pri_cfi.variant); | ||
1035 | hw->cap_act_pri_cfi.bottom = hfa384x2host_16(hw->cap_act_pri_cfi.bottom); | ||
1036 | hw->cap_act_pri_cfi.top = hfa384x2host_16(hw->cap_act_pri_cfi.top); | ||
1037 | |||
1038 | WLAN_LOG_INFO( | ||
1039 | "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
1040 | hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id, | ||
1041 | hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom, | ||
1042 | hw->cap_act_pri_cfi.top); | ||
1043 | |||
1044 | /* Compatibility range, sta f/w actor, CFI supplier */ | ||
1045 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES, | ||
1046 | &hw->cap_act_sta_cfi, sizeof(hfa384x_caplevel_t)); | ||
1047 | if ( result ) { | ||
1048 | WLAN_LOG_ERROR("Failed to retrieve STA_CFIACTRANGES\n"); | ||
1049 | goto failed; | ||
1050 | } | ||
1051 | |||
1052 | /* get all the Compatibility range, station f/w actor, CFI supplier | ||
1053 | fields in byte order */ | ||
1054 | hw->cap_act_sta_cfi.role = hfa384x2host_16(hw->cap_act_sta_cfi.role); | ||
1055 | hw->cap_act_sta_cfi.id = hfa384x2host_16(hw->cap_act_sta_cfi.id); | ||
1056 | hw->cap_act_sta_cfi.variant = hfa384x2host_16(hw->cap_act_sta_cfi.variant); | ||
1057 | hw->cap_act_sta_cfi.bottom = hfa384x2host_16(hw->cap_act_sta_cfi.bottom); | ||
1058 | hw->cap_act_sta_cfi.top = hfa384x2host_16(hw->cap_act_sta_cfi.top); | ||
1059 | |||
1060 | WLAN_LOG_INFO( | ||
1061 | "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
1062 | hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id, | ||
1063 | hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom, | ||
1064 | hw->cap_act_sta_cfi.top); | ||
1065 | |||
1066 | /* Compatibility range, sta f/w actor, MFI supplier */ | ||
1067 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES, | ||
1068 | &hw->cap_act_sta_mfi, sizeof(hfa384x_caplevel_t)); | ||
1069 | if ( result ) { | ||
1070 | WLAN_LOG_ERROR("Failed to retrieve STA_MFIACTRANGES\n"); | ||
1071 | goto failed; | ||
1072 | } | ||
1073 | |||
1074 | /* get all the Compatibility range, station f/w actor, MFI supplier | ||
1075 | fields in byte order */ | ||
1076 | hw->cap_act_sta_mfi.role = hfa384x2host_16(hw->cap_act_sta_mfi.role); | ||
1077 | hw->cap_act_sta_mfi.id = hfa384x2host_16(hw->cap_act_sta_mfi.id); | ||
1078 | hw->cap_act_sta_mfi.variant = hfa384x2host_16(hw->cap_act_sta_mfi.variant); | ||
1079 | hw->cap_act_sta_mfi.bottom = hfa384x2host_16(hw->cap_act_sta_mfi.bottom); | ||
1080 | hw->cap_act_sta_mfi.top = hfa384x2host_16(hw->cap_act_sta_mfi.top); | ||
1081 | |||
1082 | WLAN_LOG_INFO( | ||
1083 | "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", | ||
1084 | hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id, | ||
1085 | hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom, | ||
1086 | hw->cap_act_sta_mfi.top); | ||
1087 | |||
1088 | /* Serial Number */ | ||
1089 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER, | ||
1090 | snum, HFA384x_RID_NICSERIALNUMBER_LEN); | ||
1091 | if ( !result ) { | ||
1092 | wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN, | ||
1093 | pstr, sizeof(pstr)); | ||
1094 | WLAN_LOG_INFO("Prism2 card SN: %s\n", pstr); | ||
1095 | } else { | ||
1096 | WLAN_LOG_ERROR("Failed to retrieve Prism2 Card SN\n"); | ||
1097 | goto failed; | ||
1098 | } | ||
1099 | |||
1100 | /* Collect the MAC address */ | ||
1101 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR, | ||
1102 | wlandev->netdev->dev_addr, WLAN_ADDR_LEN); | ||
1103 | if ( result != 0 ) { | ||
1104 | WLAN_LOG_ERROR("Failed to retrieve mac address\n"); | ||
1105 | goto failed; | ||
1106 | } | ||
1107 | |||
1108 | /* short preamble is always implemented */ | ||
1109 | wlandev->nsdcaps |= P80211_NSDCAP_SHORT_PREAMBLE; | ||
1110 | |||
1111 | /* find out if hardware wep is implemented */ | ||
1112 | hfa384x_drvr_getconfig16(hw, HFA384x_RID_PRIVACYOPTIMP, &temp); | ||
1113 | if (temp) | ||
1114 | wlandev->nsdcaps |= P80211_NSDCAP_HARDWAREWEP; | ||
1115 | |||
1116 | /* get the dBm Scaling constant */ | ||
1117 | hfa384x_drvr_getconfig16(hw, HFA384x_RID_CNFDBMADJUST, &temp); | ||
1118 | hw->dbmadjust = temp; | ||
1119 | |||
1120 | /* Only enable scan by default on newer firmware */ | ||
1121 | if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, | ||
1122 | hw->ident_sta_fw.minor, | ||
1123 | hw->ident_sta_fw.variant) < | ||
1124 | HFA384x_FIRMWARE_VERSION(1,5,5)) { | ||
1125 | wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN; | ||
1126 | } | ||
1127 | |||
1128 | /* TODO: Set any internally managed config items */ | ||
1129 | |||
1130 | goto done; | ||
1131 | failed: | ||
1132 | WLAN_LOG_ERROR("Failed, result=%d\n", result); | ||
1133 | done: | ||
1134 | DBFEXIT; | ||
1135 | return result; | ||
1136 | } | ||
1137 | |||
1138 | |||
1139 | /*---------------------------------------------------------------- | ||
1140 | * prism2sta_globalsetup | ||
1141 | * | ||
1142 | * Set any global RIDs that we want to set at device activation. | ||
1143 | * | ||
1144 | * Arguments: | ||
1145 | * wlandev wlan device structure | ||
1146 | * | ||
1147 | * Returns: | ||
1148 | * 0 success | ||
1149 | * >0 f/w reported error | ||
1150 | * <0 driver reported error | ||
1151 | * | ||
1152 | * Side effects: | ||
1153 | * | ||
1154 | * Call context: | ||
1155 | * process thread | ||
1156 | ----------------------------------------------------------------*/ | ||
1157 | static int prism2sta_globalsetup(wlandevice_t *wlandev) | ||
1158 | { | ||
1159 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1160 | |||
1161 | /* Set the maximum frame size */ | ||
1162 | return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, | ||
1163 | WLAN_DATA_MAXLEN); | ||
1164 | } | ||
1165 | |||
1166 | static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev) | ||
1167 | { | ||
1168 | int result = 0; | ||
1169 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1170 | |||
1171 | UINT16 promisc; | ||
1172 | |||
1173 | DBFENTER; | ||
1174 | |||
1175 | /* If we're not ready, what's the point? */ | ||
1176 | if ( hw->state != HFA384x_STATE_RUNNING ) | ||
1177 | goto exit; | ||
1178 | |||
1179 | /* If we're an AP, do nothing here */ | ||
1180 | if (hw->ap) | ||
1181 | goto exit; | ||
1182 | |||
1183 | if ( (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0 ) | ||
1184 | promisc = P80211ENUM_truth_true; | ||
1185 | else | ||
1186 | promisc = P80211ENUM_truth_false; | ||
1187 | |||
1188 | result = hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE, promisc); | ||
1189 | |||
1190 | /* XXX TODO: configure the multicast list */ | ||
1191 | // CLEAR_HW_MULTICAST_LIST | ||
1192 | // struct dev_mc_list element = dev->mc_list; | ||
1193 | // while (element != null) { | ||
1194 | // HW_ADD_MULTICAST_ADDR(element->dmi_addr, dmi_addrlen) | ||
1195 | // element = element->next; | ||
1196 | // } | ||
1197 | |||
1198 | exit: | ||
1199 | DBFEXIT; | ||
1200 | return result; | ||
1201 | } | ||
1202 | |||
1203 | /*---------------------------------------------------------------- | ||
1204 | * prism2sta_inf_handover | ||
1205 | * | ||
1206 | * Handles the receipt of a Handover info frame. Should only be present | ||
1207 | * in APs only. | ||
1208 | * | ||
1209 | * Arguments: | ||
1210 | * wlandev wlan device structure | ||
1211 | * inf ptr to info frame (contents in hfa384x order) | ||
1212 | * | ||
1213 | * Returns: | ||
1214 | * nothing | ||
1215 | * | ||
1216 | * Side effects: | ||
1217 | * | ||
1218 | * Call context: | ||
1219 | * interrupt | ||
1220 | ----------------------------------------------------------------*/ | ||
1221 | static void prism2sta_inf_handover(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf) | ||
1222 | { | ||
1223 | DBFENTER; | ||
1224 | WLAN_LOG_DEBUG(2,"received infoframe:HANDOVER (unhandled)\n"); | ||
1225 | DBFEXIT; | ||
1226 | return; | ||
1227 | } | ||
1228 | |||
1229 | |||
1230 | /*---------------------------------------------------------------- | ||
1231 | * prism2sta_inf_tallies | ||
1232 | * | ||
1233 | * Handles the receipt of a CommTallies info frame. | ||
1234 | * | ||
1235 | * Arguments: | ||
1236 | * wlandev wlan device structure | ||
1237 | * inf ptr to info frame (contents in hfa384x order) | ||
1238 | * | ||
1239 | * Returns: | ||
1240 | * nothing | ||
1241 | * | ||
1242 | * Side effects: | ||
1243 | * | ||
1244 | * Call context: | ||
1245 | * interrupt | ||
1246 | ----------------------------------------------------------------*/ | ||
1247 | static void prism2sta_inf_tallies(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf) | ||
1248 | { | ||
1249 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1250 | UINT16 *src16; | ||
1251 | UINT32 *dst; | ||
1252 | UINT32 *src32; | ||
1253 | int i; | ||
1254 | int cnt; | ||
1255 | |||
1256 | DBFENTER; | ||
1257 | |||
1258 | /* | ||
1259 | ** Determine if these are 16-bit or 32-bit tallies, based on the | ||
1260 | ** record length of the info record. | ||
1261 | */ | ||
1262 | |||
1263 | cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(UINT32); | ||
1264 | if (inf->framelen > 22) { | ||
1265 | dst = (UINT32 *) &hw->tallies; | ||
1266 | src32 = (UINT32 *) &inf->info.commtallies32; | ||
1267 | for (i = 0; i < cnt; i++, dst++, src32++) | ||
1268 | *dst += hfa384x2host_32(*src32); | ||
1269 | } else { | ||
1270 | dst = (UINT32 *) &hw->tallies; | ||
1271 | src16 = (UINT16 *) &inf->info.commtallies16; | ||
1272 | for (i = 0; i < cnt; i++, dst++, src16++) | ||
1273 | *dst += hfa384x2host_16(*src16); | ||
1274 | } | ||
1275 | |||
1276 | DBFEXIT; | ||
1277 | |||
1278 | return; | ||
1279 | } | ||
1280 | |||
1281 | /*---------------------------------------------------------------- | ||
1282 | * prism2sta_inf_scanresults | ||
1283 | * | ||
1284 | * Handles the receipt of a Scan Results info frame. | ||
1285 | * | ||
1286 | * Arguments: | ||
1287 | * wlandev wlan device structure | ||
1288 | * inf ptr to info frame (contents in hfa384x order) | ||
1289 | * | ||
1290 | * Returns: | ||
1291 | * nothing | ||
1292 | * | ||
1293 | * Side effects: | ||
1294 | * | ||
1295 | * Call context: | ||
1296 | * interrupt | ||
1297 | ----------------------------------------------------------------*/ | ||
1298 | static void prism2sta_inf_scanresults(wlandevice_t *wlandev, | ||
1299 | hfa384x_InfFrame_t *inf) | ||
1300 | { | ||
1301 | |||
1302 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1303 | int nbss; | ||
1304 | hfa384x_ScanResult_t *sr = &(inf->info.scanresult); | ||
1305 | int i; | ||
1306 | hfa384x_JoinRequest_data_t joinreq; | ||
1307 | int result; | ||
1308 | DBFENTER; | ||
1309 | |||
1310 | /* Get the number of results, first in bytes, then in results */ | ||
1311 | nbss = (inf->framelen * sizeof(UINT16)) - | ||
1312 | sizeof(inf->infotype) - | ||
1313 | sizeof(inf->info.scanresult.scanreason); | ||
1314 | nbss /= sizeof(hfa384x_ScanResultSub_t); | ||
1315 | |||
1316 | /* Print em */ | ||
1317 | WLAN_LOG_DEBUG(1,"rx scanresults, reason=%d, nbss=%d:\n", | ||
1318 | inf->info.scanresult.scanreason, nbss); | ||
1319 | for ( i = 0; i < nbss; i++) { | ||
1320 | WLAN_LOG_DEBUG(1, "chid=%d anl=%d sl=%d bcnint=%d\n", | ||
1321 | sr->result[i].chid, | ||
1322 | sr->result[i].anl, | ||
1323 | sr->result[i].sl, | ||
1324 | sr->result[i].bcnint); | ||
1325 | WLAN_LOG_DEBUG(1, " capinfo=0x%04x proberesp_rate=%d\n", | ||
1326 | sr->result[i].capinfo, | ||
1327 | sr->result[i].proberesp_rate); | ||
1328 | } | ||
1329 | /* issue a join request */ | ||
1330 | joinreq.channel = sr->result[0].chid; | ||
1331 | memcpy( joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN); | ||
1332 | result = hfa384x_drvr_setconfig( hw, | ||
1333 | HFA384x_RID_JOINREQUEST, | ||
1334 | &joinreq, HFA384x_RID_JOINREQUEST_LEN); | ||
1335 | if (result) { | ||
1336 | WLAN_LOG_ERROR("setconfig(joinreq) failed, result=%d\n", result); | ||
1337 | } | ||
1338 | |||
1339 | DBFEXIT; | ||
1340 | return; | ||
1341 | } | ||
1342 | |||
1343 | /*---------------------------------------------------------------- | ||
1344 | * prism2sta_inf_hostscanresults | ||
1345 | * | ||
1346 | * Handles the receipt of a Scan Results info frame. | ||
1347 | * | ||
1348 | * Arguments: | ||
1349 | * wlandev wlan device structure | ||
1350 | * inf ptr to info frame (contents in hfa384x order) | ||
1351 | * | ||
1352 | * Returns: | ||
1353 | * nothing | ||
1354 | * | ||
1355 | * Side effects: | ||
1356 | * | ||
1357 | * Call context: | ||
1358 | * interrupt | ||
1359 | ----------------------------------------------------------------*/ | ||
1360 | static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev, | ||
1361 | hfa384x_InfFrame_t *inf) | ||
1362 | { | ||
1363 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1364 | int nbss; | ||
1365 | DBFENTER; | ||
1366 | |||
1367 | nbss = (inf->framelen - 3) / 32; | ||
1368 | WLAN_LOG_DEBUG(1, "Received %d hostscan results\n", nbss); | ||
1369 | |||
1370 | if (nbss > 32) | ||
1371 | nbss = 32; | ||
1372 | |||
1373 | if (hw->scanresults) | ||
1374 | kfree(hw->scanresults); | ||
1375 | |||
1376 | hw->scanresults = kmalloc(sizeof(hfa384x_InfFrame_t), GFP_ATOMIC); | ||
1377 | memcpy(hw->scanresults, inf, sizeof(hfa384x_InfFrame_t)); | ||
1378 | |||
1379 | if (nbss == 0) | ||
1380 | nbss = -1; | ||
1381 | |||
1382 | /* Notify/wake the sleeping caller. */ | ||
1383 | hw->scanflag = nbss; | ||
1384 | wake_up_interruptible(&hw->cmdq); | ||
1385 | |||
1386 | DBFEXIT; | ||
1387 | }; | ||
1388 | |||
1389 | /*---------------------------------------------------------------- | ||
1390 | * prism2sta_inf_chinforesults | ||
1391 | * | ||
1392 | * Handles the receipt of a Channel Info Results info frame. | ||
1393 | * | ||
1394 | * Arguments: | ||
1395 | * wlandev wlan device structure | ||
1396 | * inf ptr to info frame (contents in hfa384x order) | ||
1397 | * | ||
1398 | * Returns: | ||
1399 | * nothing | ||
1400 | * | ||
1401 | * Side effects: | ||
1402 | * | ||
1403 | * Call context: | ||
1404 | * interrupt | ||
1405 | ----------------------------------------------------------------*/ | ||
1406 | static void prism2sta_inf_chinforesults(wlandevice_t *wlandev, | ||
1407 | hfa384x_InfFrame_t *inf) | ||
1408 | { | ||
1409 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1410 | unsigned int i, n; | ||
1411 | |||
1412 | DBFENTER; | ||
1413 | hw->channel_info.results.scanchannels = | ||
1414 | hfa384x2host_16(inf->info.chinforesult.scanchannels); | ||
1415 | #if 0 | ||
1416 | memcpy(&inf->info.chinforesult, &hw->channel_info.results, sizeof(hfa384x_ChInfoResult_t)); | ||
1417 | #endif | ||
1418 | |||
1419 | for (i=0, n=0; i<HFA384x_CHINFORESULT_MAX; i++) { | ||
1420 | if (hw->channel_info.results.scanchannels & (1<<i)) { | ||
1421 | int channel=hfa384x2host_16(inf->info.chinforesult.result[n].chid)-1; | ||
1422 | hfa384x_ChInfoResultSub_t *chinforesult=&hw->channel_info.results.result[channel]; | ||
1423 | chinforesult->chid = channel; | ||
1424 | chinforesult->anl = hfa384x2host_16(inf->info.chinforesult.result[n].anl); | ||
1425 | chinforesult->pnl = hfa384x2host_16(inf->info.chinforesult.result[n].pnl); | ||
1426 | chinforesult->active = hfa384x2host_16(inf->info.chinforesult.result[n].active); | ||
1427 | WLAN_LOG_DEBUG(2, "chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n", | ||
1428 | channel+1, | ||
1429 | chinforesult->active & | ||
1430 | HFA384x_CHINFORESULT_BSSACTIVE ? "signal" : "noise", | ||
1431 | chinforesult->anl, chinforesult->pnl, | ||
1432 | chinforesult->active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0 | ||
1433 | ); | ||
1434 | n++; | ||
1435 | } | ||
1436 | } | ||
1437 | atomic_set(&hw->channel_info.done, 2); | ||
1438 | |||
1439 | hw->channel_info.count = n; | ||
1440 | DBFEXIT; | ||
1441 | return; | ||
1442 | } | ||
1443 | |||
1444 | void prism2sta_processing_defer(struct work_struct *data) | ||
1445 | { | ||
1446 | hfa384x_t *hw = container_of(data, struct hfa384x, link_bh); | ||
1447 | wlandevice_t *wlandev = hw->wlandev; | ||
1448 | hfa384x_bytestr32_t ssid; | ||
1449 | int result; | ||
1450 | |||
1451 | DBFENTER; | ||
1452 | /* First let's process the auth frames */ | ||
1453 | { | ||
1454 | struct sk_buff *skb; | ||
1455 | hfa384x_InfFrame_t *inf; | ||
1456 | |||
1457 | while ( (skb = skb_dequeue(&hw->authq)) ) { | ||
1458 | inf = (hfa384x_InfFrame_t *) skb->data; | ||
1459 | prism2sta_inf_authreq_defer(wlandev, inf); | ||
1460 | } | ||
1461 | |||
1462 | } | ||
1463 | |||
1464 | /* Now let's handle the linkstatus stuff */ | ||
1465 | if (hw->link_status == hw->link_status_new) | ||
1466 | goto failed; | ||
1467 | |||
1468 | hw->link_status = hw->link_status_new; | ||
1469 | |||
1470 | switch(hw->link_status) { | ||
1471 | case HFA384x_LINK_NOTCONNECTED: | ||
1472 | /* I'm currently assuming that this is the initial link | ||
1473 | * state. It should only be possible immediately | ||
1474 | * following an Enable command. | ||
1475 | * Response: | ||
1476 | * Block Transmits, Ignore receives of data frames | ||
1477 | */ | ||
1478 | netif_carrier_off(wlandev->netdev); | ||
1479 | |||
1480 | WLAN_LOG_INFO("linkstatus=NOTCONNECTED (unhandled)\n"); | ||
1481 | break; | ||
1482 | |||
1483 | case HFA384x_LINK_CONNECTED: | ||
1484 | /* This one indicates a successful scan/join/auth/assoc. | ||
1485 | * When we have the full MLME complement, this event will | ||
1486 | * signify successful completion of both mlme_authenticate | ||
1487 | * and mlme_associate. State management will get a little | ||
1488 | * ugly here. | ||
1489 | * Response: | ||
1490 | * Indicate authentication and/or association | ||
1491 | * Enable Transmits, Receives and pass up data frames | ||
1492 | */ | ||
1493 | |||
1494 | netif_carrier_on(wlandev->netdev); | ||
1495 | |||
1496 | /* If we are joining a specific AP, set our state and reset retries */ | ||
1497 | if(hw->join_ap == 1) | ||
1498 | hw->join_ap = 2; | ||
1499 | hw->join_retries = 60; | ||
1500 | |||
1501 | /* Don't call this in monitor mode */ | ||
1502 | if ( wlandev->netdev->type == ARPHRD_ETHER ) { | ||
1503 | UINT16 portstatus; | ||
1504 | |||
1505 | WLAN_LOG_INFO("linkstatus=CONNECTED\n"); | ||
1506 | |||
1507 | /* For non-usb devices, we can use the sync versions */ | ||
1508 | /* Collect the BSSID, and set state to allow tx */ | ||
1509 | |||
1510 | result = hfa384x_drvr_getconfig(hw, | ||
1511 | HFA384x_RID_CURRENTBSSID, | ||
1512 | wlandev->bssid, WLAN_BSSID_LEN); | ||
1513 | if ( result ) { | ||
1514 | WLAN_LOG_DEBUG(1, | ||
1515 | "getconfig(0x%02x) failed, result = %d\n", | ||
1516 | HFA384x_RID_CURRENTBSSID, result); | ||
1517 | goto failed; | ||
1518 | } | ||
1519 | |||
1520 | result = hfa384x_drvr_getconfig(hw, | ||
1521 | HFA384x_RID_CURRENTSSID, | ||
1522 | &ssid, sizeof(ssid)); | ||
1523 | if ( result ) { | ||
1524 | WLAN_LOG_DEBUG(1, | ||
1525 | "getconfig(0x%02x) failed, result = %d\n", | ||
1526 | HFA384x_RID_CURRENTSSID, result); | ||
1527 | goto failed; | ||
1528 | } | ||
1529 | prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid, | ||
1530 | (p80211pstrd_t *) &wlandev->ssid); | ||
1531 | |||
1532 | /* Collect the port status */ | ||
1533 | result = hfa384x_drvr_getconfig16(hw, | ||
1534 | HFA384x_RID_PORTSTATUS, &portstatus); | ||
1535 | if ( result ) { | ||
1536 | WLAN_LOG_DEBUG(1, | ||
1537 | "getconfig(0x%02x) failed, result = %d\n", | ||
1538 | HFA384x_RID_PORTSTATUS, result); | ||
1539 | goto failed; | ||
1540 | } | ||
1541 | wlandev->macmode = | ||
1542 | (portstatus == HFA384x_PSTATUS_CONN_IBSS) ? | ||
1543 | WLAN_MACMODE_IBSS_STA : WLAN_MACMODE_ESS_STA; | ||
1544 | |||
1545 | /* Get the ball rolling on the comms quality stuff */ | ||
1546 | prism2sta_commsqual_defer(&hw->commsqual_bh); | ||
1547 | } | ||
1548 | break; | ||
1549 | |||
1550 | case HFA384x_LINK_DISCONNECTED: | ||
1551 | /* This one indicates that our association is gone. We've | ||
1552 | * lost connection with the AP and/or been disassociated. | ||
1553 | * This indicates that the MAC has completely cleared it's | ||
1554 | * associated state. We * should send a deauth indication | ||
1555 | * (implying disassoc) up * to the MLME. | ||
1556 | * Response: | ||
1557 | * Indicate Deauthentication | ||
1558 | * Block Transmits, Ignore receives of data frames | ||
1559 | */ | ||
1560 | if(hw->join_ap == 2) | ||
1561 | { | ||
1562 | hfa384x_JoinRequest_data_t joinreq; | ||
1563 | joinreq = hw->joinreq; | ||
1564 | /* Send the join request */ | ||
1565 | hfa384x_drvr_setconfig( hw, | ||
1566 | HFA384x_RID_JOINREQUEST, | ||
1567 | &joinreq, HFA384x_RID_JOINREQUEST_LEN); | ||
1568 | WLAN_LOG_INFO("linkstatus=DISCONNECTED (re-submitting join)\n"); | ||
1569 | } else { | ||
1570 | if (wlandev->netdev->type == ARPHRD_ETHER) | ||
1571 | WLAN_LOG_INFO("linkstatus=DISCONNECTED (unhandled)\n"); | ||
1572 | } | ||
1573 | wlandev->macmode = WLAN_MACMODE_NONE; | ||
1574 | |||
1575 | netif_carrier_off(wlandev->netdev); | ||
1576 | |||
1577 | break; | ||
1578 | |||
1579 | case HFA384x_LINK_AP_CHANGE: | ||
1580 | /* This one indicates that the MAC has decided to and | ||
1581 | * successfully completed a change to another AP. We | ||
1582 | * should probably implement a reassociation indication | ||
1583 | * in response to this one. I'm thinking that the the | ||
1584 | * p80211 layer needs to be notified in case of | ||
1585 | * buffering/queueing issues. User mode also needs to be | ||
1586 | * notified so that any BSS dependent elements can be | ||
1587 | * updated. | ||
1588 | * associated state. We * should send a deauth indication | ||
1589 | * (implying disassoc) up * to the MLME. | ||
1590 | * Response: | ||
1591 | * Indicate Reassociation | ||
1592 | * Enable Transmits, Receives and pass up data frames | ||
1593 | */ | ||
1594 | WLAN_LOG_INFO("linkstatus=AP_CHANGE\n"); | ||
1595 | |||
1596 | result = hfa384x_drvr_getconfig(hw, | ||
1597 | HFA384x_RID_CURRENTBSSID, | ||
1598 | wlandev->bssid, WLAN_BSSID_LEN); | ||
1599 | if ( result ) { | ||
1600 | WLAN_LOG_DEBUG(1, | ||
1601 | "getconfig(0x%02x) failed, result = %d\n", | ||
1602 | HFA384x_RID_CURRENTBSSID, result); | ||
1603 | goto failed; | ||
1604 | } | ||
1605 | |||
1606 | result = hfa384x_drvr_getconfig(hw, | ||
1607 | HFA384x_RID_CURRENTSSID, | ||
1608 | &ssid, sizeof(ssid)); | ||
1609 | if ( result ) { | ||
1610 | WLAN_LOG_DEBUG(1, | ||
1611 | "getconfig(0x%02x) failed, result = %d\n", | ||
1612 | HFA384x_RID_CURRENTSSID, result); | ||
1613 | goto failed; | ||
1614 | } | ||
1615 | prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid, | ||
1616 | (p80211pstrd_t *) &wlandev->ssid); | ||
1617 | |||
1618 | |||
1619 | hw->link_status = HFA384x_LINK_CONNECTED; | ||
1620 | netif_carrier_on(wlandev->netdev); | ||
1621 | |||
1622 | break; | ||
1623 | |||
1624 | case HFA384x_LINK_AP_OUTOFRANGE: | ||
1625 | /* This one indicates that the MAC has decided that the | ||
1626 | * AP is out of range, but hasn't found a better candidate | ||
1627 | * so the MAC maintains its "associated" state in case | ||
1628 | * we get back in range. We should block transmits and | ||
1629 | * receives in this state. Do we need an indication here? | ||
1630 | * Probably not since a polling user-mode element would | ||
1631 | * get this status from from p2PortStatus(FD40). What about | ||
1632 | * p80211? | ||
1633 | * Response: | ||
1634 | * Block Transmits, Ignore receives of data frames | ||
1635 | */ | ||
1636 | WLAN_LOG_INFO("linkstatus=AP_OUTOFRANGE (unhandled)\n"); | ||
1637 | |||
1638 | netif_carrier_off(wlandev->netdev); | ||
1639 | |||
1640 | break; | ||
1641 | |||
1642 | case HFA384x_LINK_AP_INRANGE: | ||
1643 | /* This one indicates that the MAC has decided that the | ||
1644 | * AP is back in range. We continue working with our | ||
1645 | * existing association. | ||
1646 | * Response: | ||
1647 | * Enable Transmits, Receives and pass up data frames | ||
1648 | */ | ||
1649 | WLAN_LOG_INFO("linkstatus=AP_INRANGE\n"); | ||
1650 | |||
1651 | hw->link_status = HFA384x_LINK_CONNECTED; | ||
1652 | netif_carrier_on(wlandev->netdev); | ||
1653 | |||
1654 | break; | ||
1655 | |||
1656 | case HFA384x_LINK_ASSOCFAIL: | ||
1657 | /* This one is actually a peer to CONNECTED. We've | ||
1658 | * requested a join for a given SSID and optionally BSSID. | ||
1659 | * We can use this one to indicate authentication and | ||
1660 | * association failures. The trick is going to be | ||
1661 | * 1) identifying the failure, and 2) state management. | ||
1662 | * Response: | ||
1663 | * Disable Transmits, Ignore receives of data frames | ||
1664 | */ | ||
1665 | if(hw->join_ap && --hw->join_retries > 0) | ||
1666 | { | ||
1667 | hfa384x_JoinRequest_data_t joinreq; | ||
1668 | joinreq = hw->joinreq; | ||
1669 | /* Send the join request */ | ||
1670 | hfa384x_drvr_setconfig( hw, | ||
1671 | HFA384x_RID_JOINREQUEST, | ||
1672 | &joinreq, HFA384x_RID_JOINREQUEST_LEN); | ||
1673 | WLAN_LOG_INFO("linkstatus=ASSOCFAIL (re-submitting join)\n"); | ||
1674 | } else { | ||
1675 | WLAN_LOG_INFO("linkstatus=ASSOCFAIL (unhandled)\n"); | ||
1676 | } | ||
1677 | |||
1678 | netif_carrier_off(wlandev->netdev); | ||
1679 | |||
1680 | break; | ||
1681 | |||
1682 | default: | ||
1683 | /* This is bad, IO port problems? */ | ||
1684 | WLAN_LOG_WARNING( | ||
1685 | "unknown linkstatus=0x%02x\n", hw->link_status); | ||
1686 | goto failed; | ||
1687 | break; | ||
1688 | } | ||
1689 | |||
1690 | wlandev->linkstatus = (hw->link_status == HFA384x_LINK_CONNECTED); | ||
1691 | #ifdef WIRELESS_EXT | ||
1692 | p80211wext_event_associated(wlandev, wlandev->linkstatus); | ||
1693 | #endif | ||
1694 | |||
1695 | failed: | ||
1696 | DBFEXIT; | ||
1697 | } | ||
1698 | |||
1699 | /*---------------------------------------------------------------- | ||
1700 | * prism2sta_inf_linkstatus | ||
1701 | * | ||
1702 | * Handles the receipt of a Link Status info frame. | ||
1703 | * | ||
1704 | * Arguments: | ||
1705 | * wlandev wlan device structure | ||
1706 | * inf ptr to info frame (contents in hfa384x order) | ||
1707 | * | ||
1708 | * Returns: | ||
1709 | * nothing | ||
1710 | * | ||
1711 | * Side effects: | ||
1712 | * | ||
1713 | * Call context: | ||
1714 | * interrupt | ||
1715 | ----------------------------------------------------------------*/ | ||
1716 | static void prism2sta_inf_linkstatus(wlandevice_t *wlandev, | ||
1717 | hfa384x_InfFrame_t *inf) | ||
1718 | { | ||
1719 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1720 | |||
1721 | DBFENTER; | ||
1722 | |||
1723 | hw->link_status_new = hfa384x2host_16(inf->info.linkstatus.linkstatus); | ||
1724 | |||
1725 | schedule_work(&hw->link_bh); | ||
1726 | |||
1727 | DBFEXIT; | ||
1728 | return; | ||
1729 | } | ||
1730 | |||
1731 | /*---------------------------------------------------------------- | ||
1732 | * prism2sta_inf_assocstatus | ||
1733 | * | ||
1734 | * Handles the receipt of an Association Status info frame. Should | ||
1735 | * be present in APs only. | ||
1736 | * | ||
1737 | * Arguments: | ||
1738 | * wlandev wlan device structure | ||
1739 | * inf ptr to info frame (contents in hfa384x order) | ||
1740 | * | ||
1741 | * Returns: | ||
1742 | * nothing | ||
1743 | * | ||
1744 | * Side effects: | ||
1745 | * | ||
1746 | * Call context: | ||
1747 | * interrupt | ||
1748 | ----------------------------------------------------------------*/ | ||
1749 | static void prism2sta_inf_assocstatus(wlandevice_t *wlandev, | ||
1750 | hfa384x_InfFrame_t *inf) | ||
1751 | { | ||
1752 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1753 | hfa384x_AssocStatus_t rec; | ||
1754 | int i; | ||
1755 | |||
1756 | DBFENTER; | ||
1757 | |||
1758 | memcpy(&rec, &inf->info.assocstatus, sizeof(rec)); | ||
1759 | rec.assocstatus = hfa384x2host_16(rec.assocstatus); | ||
1760 | rec.reason = hfa384x2host_16(rec.reason); | ||
1761 | |||
1762 | /* | ||
1763 | ** Find the address in the list of authenticated stations. If it wasn't | ||
1764 | ** found, then this address has not been previously authenticated and | ||
1765 | ** something weird has happened if this is anything other than an | ||
1766 | ** "authentication failed" message. If the address was found, then | ||
1767 | ** set the "associated" flag for that station, based on whether the | ||
1768 | ** station is associating or losing its association. Something weird | ||
1769 | ** has also happened if we find the address in the list of authenticated | ||
1770 | ** stations but we are getting an "authentication failed" message. | ||
1771 | */ | ||
1772 | |||
1773 | for (i = 0; i < hw->authlist.cnt; i++) | ||
1774 | if (memcmp(rec.sta_addr, hw->authlist.addr[i], WLAN_ADDR_LEN) == 0) | ||
1775 | break; | ||
1776 | |||
1777 | if (i >= hw->authlist.cnt) { | ||
1778 | if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL) | ||
1779 | WLAN_LOG_WARNING("assocstatus info frame received for non-authenticated station.\n"); | ||
1780 | } else { | ||
1781 | hw->authlist.assoc[i] = | ||
1782 | (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC || | ||
1783 | rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC); | ||
1784 | |||
1785 | if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL) | ||
1786 | WLAN_LOG_WARNING("authfail assocstatus info frame received for authenticated station.\n"); | ||
1787 | } | ||
1788 | |||
1789 | DBFEXIT; | ||
1790 | |||
1791 | return; | ||
1792 | } | ||
1793 | |||
1794 | /*---------------------------------------------------------------- | ||
1795 | * prism2sta_inf_authreq | ||
1796 | * | ||
1797 | * Handles the receipt of an Authentication Request info frame. Should | ||
1798 | * be present in APs only. | ||
1799 | * | ||
1800 | * Arguments: | ||
1801 | * wlandev wlan device structure | ||
1802 | * inf ptr to info frame (contents in hfa384x order) | ||
1803 | * | ||
1804 | * Returns: | ||
1805 | * nothing | ||
1806 | * | ||
1807 | * Side effects: | ||
1808 | * | ||
1809 | * Call context: | ||
1810 | * interrupt | ||
1811 | * | ||
1812 | ----------------------------------------------------------------*/ | ||
1813 | static void prism2sta_inf_authreq(wlandevice_t *wlandev, | ||
1814 | hfa384x_InfFrame_t *inf) | ||
1815 | { | ||
1816 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1817 | struct sk_buff *skb; | ||
1818 | |||
1819 | DBFENTER; | ||
1820 | |||
1821 | skb = dev_alloc_skb(sizeof(*inf)); | ||
1822 | if (skb) { | ||
1823 | skb_put(skb, sizeof(*inf)); | ||
1824 | memcpy(skb->data, inf, sizeof(*inf)); | ||
1825 | skb_queue_tail(&hw->authq, skb); | ||
1826 | schedule_work(&hw->link_bh); | ||
1827 | } | ||
1828 | |||
1829 | DBFEXIT; | ||
1830 | } | ||
1831 | |||
1832 | static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev, | ||
1833 | hfa384x_InfFrame_t *inf) | ||
1834 | { | ||
1835 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
1836 | hfa384x_authenticateStation_data_t rec; | ||
1837 | |||
1838 | int i, added, result, cnt; | ||
1839 | UINT8 *addr; | ||
1840 | |||
1841 | DBFENTER; | ||
1842 | |||
1843 | /* | ||
1844 | ** Build the AuthenticateStation record. Initialize it for denying | ||
1845 | ** authentication. | ||
1846 | */ | ||
1847 | |||
1848 | memcpy(rec.address, inf->info.authreq.sta_addr, WLAN_ADDR_LEN); | ||
1849 | rec.status = P80211ENUM_status_unspec_failure; | ||
1850 | |||
1851 | /* | ||
1852 | ** Authenticate based on the access mode. | ||
1853 | */ | ||
1854 | |||
1855 | switch (hw->accessmode) { | ||
1856 | case WLAN_ACCESS_NONE: | ||
1857 | |||
1858 | /* | ||
1859 | ** Deny all new authentications. However, if a station | ||
1860 | ** is ALREADY authenticated, then accept it. | ||
1861 | */ | ||
1862 | |||
1863 | for (i = 0; i < hw->authlist.cnt; i++) | ||
1864 | if (memcmp(rec.address, hw->authlist.addr[i], | ||
1865 | WLAN_ADDR_LEN) == 0) { | ||
1866 | rec.status = P80211ENUM_status_successful; | ||
1867 | break; | ||
1868 | } | ||
1869 | |||
1870 | break; | ||
1871 | |||
1872 | case WLAN_ACCESS_ALL: | ||
1873 | |||
1874 | /* | ||
1875 | ** Allow all authentications. | ||
1876 | */ | ||
1877 | |||
1878 | rec.status = P80211ENUM_status_successful; | ||
1879 | break; | ||
1880 | |||
1881 | case WLAN_ACCESS_ALLOW: | ||
1882 | |||
1883 | /* | ||
1884 | ** Only allow the authentication if the MAC address | ||
1885 | ** is in the list of allowed addresses. | ||
1886 | ** | ||
1887 | ** Since this is the interrupt handler, we may be here | ||
1888 | ** while the access list is in the middle of being | ||
1889 | ** updated. Choose the list which is currently okay. | ||
1890 | ** See "prism2mib_priv_accessallow()" for details. | ||
1891 | */ | ||
1892 | |||
1893 | if (hw->allow.modify == 0) { | ||
1894 | cnt = hw->allow.cnt; | ||
1895 | addr = hw->allow.addr[0]; | ||
1896 | } else { | ||
1897 | cnt = hw->allow.cnt1; | ||
1898 | addr = hw->allow.addr1[0]; | ||
1899 | } | ||
1900 | |||
1901 | for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN) | ||
1902 | if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) { | ||
1903 | rec.status = P80211ENUM_status_successful; | ||
1904 | break; | ||
1905 | } | ||
1906 | |||
1907 | break; | ||
1908 | |||
1909 | case WLAN_ACCESS_DENY: | ||
1910 | |||
1911 | /* | ||
1912 | ** Allow the authentication UNLESS the MAC address is | ||
1913 | ** in the list of denied addresses. | ||
1914 | ** | ||
1915 | ** Since this is the interrupt handler, we may be here | ||
1916 | ** while the access list is in the middle of being | ||
1917 | ** updated. Choose the list which is currently okay. | ||
1918 | ** See "prism2mib_priv_accessdeny()" for details. | ||
1919 | */ | ||
1920 | |||
1921 | if (hw->deny.modify == 0) { | ||
1922 | cnt = hw->deny.cnt; | ||
1923 | addr = hw->deny.addr[0]; | ||
1924 | } else { | ||
1925 | cnt = hw->deny.cnt1; | ||
1926 | addr = hw->deny.addr1[0]; | ||
1927 | } | ||
1928 | |||
1929 | rec.status = P80211ENUM_status_successful; | ||
1930 | |||
1931 | for (i = 0; i < cnt; i++, addr += WLAN_ADDR_LEN) | ||
1932 | if (memcmp(rec.address, addr, WLAN_ADDR_LEN) == 0) { | ||
1933 | rec.status = P80211ENUM_status_unspec_failure; | ||
1934 | break; | ||
1935 | } | ||
1936 | |||
1937 | break; | ||
1938 | } | ||
1939 | |||
1940 | /* | ||
1941 | ** If the authentication is okay, then add the MAC address to the list | ||
1942 | ** of authenticated stations. Don't add the address if it is already in | ||
1943 | ** the list. (802.11b does not seem to disallow a station from issuing | ||
1944 | ** an authentication request when the station is already authenticated. | ||
1945 | ** Does this sort of thing ever happen? We might as well do the check | ||
1946 | ** just in case.) | ||
1947 | */ | ||
1948 | |||
1949 | added = 0; | ||
1950 | |||
1951 | if (rec.status == P80211ENUM_status_successful) { | ||
1952 | for (i = 0; i < hw->authlist.cnt; i++) | ||
1953 | if (memcmp(rec.address, hw->authlist.addr[i], WLAN_ADDR_LEN) == 0) | ||
1954 | break; | ||
1955 | |||
1956 | if (i >= hw->authlist.cnt) { | ||
1957 | if (hw->authlist.cnt >= WLAN_AUTH_MAX) { | ||
1958 | rec.status = P80211ENUM_status_ap_full; | ||
1959 | } else { | ||
1960 | memcpy(hw->authlist.addr[hw->authlist.cnt], | ||
1961 | rec.address, WLAN_ADDR_LEN); | ||
1962 | hw->authlist.cnt++; | ||
1963 | added = 1; | ||
1964 | } | ||
1965 | } | ||
1966 | } | ||
1967 | |||
1968 | /* | ||
1969 | ** Send back the results of the authentication. If this doesn't work, | ||
1970 | ** then make sure to remove the address from the authenticated list if | ||
1971 | ** it was added. | ||
1972 | */ | ||
1973 | |||
1974 | rec.status = host2hfa384x_16(rec.status); | ||
1975 | rec.algorithm = inf->info.authreq.algorithm; | ||
1976 | |||
1977 | result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA, | ||
1978 | &rec, sizeof(rec)); | ||
1979 | if (result) { | ||
1980 | if (added) hw->authlist.cnt--; | ||
1981 | WLAN_LOG_ERROR("setconfig(authenticatestation) failed, result=%d\n", result); | ||
1982 | } | ||
1983 | |||
1984 | DBFEXIT; | ||
1985 | |||
1986 | return; | ||
1987 | } | ||
1988 | |||
1989 | |||
1990 | /*---------------------------------------------------------------- | ||
1991 | * prism2sta_inf_psusercnt | ||
1992 | * | ||
1993 | * Handles the receipt of a PowerSaveUserCount info frame. Should | ||
1994 | * be present in APs only. | ||
1995 | * | ||
1996 | * Arguments: | ||
1997 | * wlandev wlan device structure | ||
1998 | * inf ptr to info frame (contents in hfa384x order) | ||
1999 | * | ||
2000 | * Returns: | ||
2001 | * nothing | ||
2002 | * | ||
2003 | * Side effects: | ||
2004 | * | ||
2005 | * Call context: | ||
2006 | * interrupt | ||
2007 | ----------------------------------------------------------------*/ | ||
2008 | static void prism2sta_inf_psusercnt(wlandevice_t *wlandev, | ||
2009 | hfa384x_InfFrame_t *inf) | ||
2010 | { | ||
2011 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
2012 | |||
2013 | DBFENTER; | ||
2014 | |||
2015 | hw->psusercount = hfa384x2host_16(inf->info.psusercnt.usercnt); | ||
2016 | |||
2017 | DBFEXIT; | ||
2018 | |||
2019 | return; | ||
2020 | } | ||
2021 | |||
2022 | /*---------------------------------------------------------------- | ||
2023 | * prism2sta_ev_dtim | ||
2024 | * | ||
2025 | * Handles the DTIM early warning event. | ||
2026 | * | ||
2027 | * Arguments: | ||
2028 | * wlandev wlan device structure | ||
2029 | * | ||
2030 | * Returns: | ||
2031 | * nothing | ||
2032 | * | ||
2033 | * Side effects: | ||
2034 | * | ||
2035 | * Call context: | ||
2036 | * interrupt | ||
2037 | ----------------------------------------------------------------*/ | ||
2038 | void prism2sta_ev_dtim(wlandevice_t *wlandev) | ||
2039 | { | ||
2040 | #if 0 | ||
2041 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
2042 | #endif | ||
2043 | DBFENTER; | ||
2044 | WLAN_LOG_DEBUG(3, "DTIM event, currently unhandled.\n"); | ||
2045 | DBFEXIT; | ||
2046 | return; | ||
2047 | } | ||
2048 | |||
2049 | |||
2050 | /*---------------------------------------------------------------- | ||
2051 | * prism2sta_ev_infdrop | ||
2052 | * | ||
2053 | * Handles the InfDrop event. | ||
2054 | * | ||
2055 | * Arguments: | ||
2056 | * wlandev wlan device structure | ||
2057 | * | ||
2058 | * Returns: | ||
2059 | * nothing | ||
2060 | * | ||
2061 | * Side effects: | ||
2062 | * | ||
2063 | * Call context: | ||
2064 | * interrupt | ||
2065 | ----------------------------------------------------------------*/ | ||
2066 | void prism2sta_ev_infdrop(wlandevice_t *wlandev) | ||
2067 | { | ||
2068 | #if 0 | ||
2069 | hfa384x_t *hw = (hfa384x_t *)wlandev->priv; | ||
2070 | #endif | ||
2071 | DBFENTER; | ||
2072 | WLAN_LOG_DEBUG(3, "Info frame dropped due to card mem low.\n"); | ||
2073 | DBFEXIT; | ||
2074 | return; | ||
2075 | } | ||
2076 | |||
2077 | |||
2078 | /*---------------------------------------------------------------- | ||
2079 | * prism2sta_ev_info | ||
2080 | * | ||
2081 | * Handles the Info event. | ||
2082 | * | ||
2083 | * Arguments: | ||
2084 | * wlandev wlan device structure | ||
2085 | * inf ptr to a generic info frame | ||
2086 | * | ||
2087 | * Returns: | ||
2088 | * nothing | ||
2089 | * | ||
2090 | * Side effects: | ||
2091 | * | ||
2092 | * Call context: | ||
2093 | * interrupt | ||
2094 | ----------------------------------------------------------------*/ | ||
2095 | void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf) | ||
2096 | { | ||
2097 | DBFENTER; | ||
2098 | inf->infotype = hfa384x2host_16(inf->infotype); | ||
2099 | /* Dispatch */ | ||
2100 | switch ( inf->infotype ) { | ||
2101 | case HFA384x_IT_HANDOVERADDR: | ||
2102 | prism2sta_inf_handover(wlandev, inf); | ||
2103 | break; | ||
2104 | case HFA384x_IT_COMMTALLIES: | ||
2105 | prism2sta_inf_tallies(wlandev, inf); | ||
2106 | break; | ||
2107 | case HFA384x_IT_HOSTSCANRESULTS: | ||
2108 | prism2sta_inf_hostscanresults(wlandev, inf); | ||
2109 | break; | ||
2110 | case HFA384x_IT_SCANRESULTS: | ||
2111 | prism2sta_inf_scanresults(wlandev, inf); | ||
2112 | break; | ||
2113 | case HFA384x_IT_CHINFORESULTS: | ||
2114 | prism2sta_inf_chinforesults(wlandev, inf); | ||
2115 | break; | ||
2116 | case HFA384x_IT_LINKSTATUS: | ||
2117 | prism2sta_inf_linkstatus(wlandev, inf); | ||
2118 | break; | ||
2119 | case HFA384x_IT_ASSOCSTATUS: | ||
2120 | prism2sta_inf_assocstatus(wlandev, inf); | ||
2121 | break; | ||
2122 | case HFA384x_IT_AUTHREQ: | ||
2123 | prism2sta_inf_authreq(wlandev, inf); | ||
2124 | break; | ||
2125 | case HFA384x_IT_PSUSERCNT: | ||
2126 | prism2sta_inf_psusercnt(wlandev, inf); | ||
2127 | break; | ||
2128 | case HFA384x_IT_KEYIDCHANGED: | ||
2129 | WLAN_LOG_WARNING("Unhandled IT_KEYIDCHANGED\n"); | ||
2130 | break; | ||
2131 | case HFA384x_IT_ASSOCREQ: | ||
2132 | WLAN_LOG_WARNING("Unhandled IT_ASSOCREQ\n"); | ||
2133 | break; | ||
2134 | case HFA384x_IT_MICFAILURE: | ||
2135 | WLAN_LOG_WARNING("Unhandled IT_MICFAILURE\n"); | ||
2136 | break; | ||
2137 | default: | ||
2138 | WLAN_LOG_WARNING( | ||
2139 | "Unknown info type=0x%02x\n", inf->infotype); | ||
2140 | break; | ||
2141 | } | ||
2142 | DBFEXIT; | ||
2143 | return; | ||
2144 | } | ||
2145 | |||
2146 | |||
2147 | /*---------------------------------------------------------------- | ||
2148 | * prism2sta_ev_txexc | ||
2149 | * | ||
2150 | * Handles the TxExc event. A Transmit Exception event indicates | ||
2151 | * that the MAC's TX process was unsuccessful - so the packet did | ||
2152 | * not get transmitted. | ||
2153 | * | ||
2154 | * Arguments: | ||
2155 | * wlandev wlan device structure | ||
2156 | * status tx frame status word | ||
2157 | * | ||
2158 | * Returns: | ||
2159 | * nothing | ||
2160 | * | ||
2161 | * Side effects: | ||
2162 | * | ||
2163 | * Call context: | ||
2164 | * interrupt | ||
2165 | ----------------------------------------------------------------*/ | ||
2166 | void prism2sta_ev_txexc(wlandevice_t *wlandev, UINT16 status) | ||
2167 | { | ||
2168 | DBFENTER; | ||
2169 | |||
2170 | WLAN_LOG_DEBUG(3, "TxExc status=0x%x.\n", status); | ||
2171 | |||
2172 | DBFEXIT; | ||
2173 | return; | ||
2174 | } | ||
2175 | |||
2176 | |||
2177 | /*---------------------------------------------------------------- | ||
2178 | * prism2sta_ev_tx | ||
2179 | * | ||
2180 | * Handles the Tx event. | ||
2181 | * | ||
2182 | * Arguments: | ||
2183 | * wlandev wlan device structure | ||
2184 | * status tx frame status word | ||
2185 | * Returns: | ||
2186 | * nothing | ||
2187 | * | ||
2188 | * Side effects: | ||
2189 | * | ||
2190 | * Call context: | ||
2191 | * interrupt | ||
2192 | ----------------------------------------------------------------*/ | ||
2193 | void prism2sta_ev_tx(wlandevice_t *wlandev, UINT16 status) | ||
2194 | { | ||
2195 | DBFENTER; | ||
2196 | WLAN_LOG_DEBUG(4, "Tx Complete, status=0x%04x\n", status); | ||
2197 | /* update linux network stats */ | ||
2198 | wlandev->linux_stats.tx_packets++; | ||
2199 | DBFEXIT; | ||
2200 | return; | ||
2201 | } | ||
2202 | |||
2203 | |||
2204 | /*---------------------------------------------------------------- | ||
2205 | * prism2sta_ev_rx | ||
2206 | * | ||
2207 | * Handles the Rx event. | ||
2208 | * | ||
2209 | * Arguments: | ||
2210 | * wlandev wlan device structure | ||
2211 | * | ||
2212 | * Returns: | ||
2213 | * nothing | ||
2214 | * | ||
2215 | * Side effects: | ||
2216 | * | ||
2217 | * Call context: | ||
2218 | * interrupt | ||
2219 | ----------------------------------------------------------------*/ | ||
2220 | void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb) | ||
2221 | { | ||
2222 | DBFENTER; | ||
2223 | |||
2224 | p80211netdev_rx(wlandev, skb); | ||
2225 | |||
2226 | DBFEXIT; | ||
2227 | return; | ||
2228 | } | ||
2229 | |||
2230 | /*---------------------------------------------------------------- | ||
2231 | * prism2sta_ev_alloc | ||
2232 | * | ||
2233 | * Handles the Alloc event. | ||
2234 | * | ||
2235 | * Arguments: | ||
2236 | * wlandev wlan device structure | ||
2237 | * | ||
2238 | * Returns: | ||
2239 | * nothing | ||
2240 | * | ||
2241 | * Side effects: | ||
2242 | * | ||
2243 | * Call context: | ||
2244 | * interrupt | ||
2245 | ----------------------------------------------------------------*/ | ||
2246 | void prism2sta_ev_alloc(wlandevice_t *wlandev) | ||
2247 | { | ||
2248 | DBFENTER; | ||
2249 | |||
2250 | p80211netdev_wake_queue(wlandev); | ||
2251 | |||
2252 | DBFEXIT; | ||
2253 | return; | ||
2254 | } | ||
2255 | |||
2256 | #if (WLAN_HOSTIF == WLAN_PLX || WLAN_HOSTIF == WLAN_PCI) | ||
2257 | #ifdef CONFIG_PM | ||
2258 | static int prism2sta_suspend_pci(struct pci_dev *pdev, pm_message_t state) | ||
2259 | { | ||
2260 | wlandevice_t *wlandev; | ||
2261 | |||
2262 | wlandev = (wlandevice_t *) pci_get_drvdata(pdev); | ||
2263 | |||
2264 | /* reset hardware */ | ||
2265 | if (wlandev) { | ||
2266 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
2267 | p80211_suspend(wlandev); | ||
2268 | } | ||
2269 | |||
2270 | // call a netif_device_detach(wlandev->netdev) ? | ||
2271 | |||
2272 | return 0; | ||
2273 | } | ||
2274 | |||
2275 | static int prism2sta_resume_pci (struct pci_dev *pdev) | ||
2276 | { | ||
2277 | wlandevice_t *wlandev; | ||
2278 | |||
2279 | wlandev = (wlandevice_t *) pci_get_drvdata(pdev); | ||
2280 | |||
2281 | if (wlandev) { | ||
2282 | prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable); | ||
2283 | p80211_resume(wlandev); | ||
2284 | } | ||
2285 | |||
2286 | return 0; | ||
2287 | } | ||
2288 | #endif | ||
2289 | #endif | ||
2290 | |||
2291 | /*---------------------------------------------------------------- | ||
2292 | * create_wlan | ||
2293 | * | ||
2294 | * Called at module init time. This creates the wlandevice_t structure | ||
2295 | * and initializes it with relevant bits. | ||
2296 | * | ||
2297 | * Arguments: | ||
2298 | * none | ||
2299 | * | ||
2300 | * Returns: | ||
2301 | * the created wlandevice_t structure. | ||
2302 | * | ||
2303 | * Side effects: | ||
2304 | * also allocates the priv/hw structures. | ||
2305 | * | ||
2306 | * Call context: | ||
2307 | * process thread | ||
2308 | * | ||
2309 | ----------------------------------------------------------------*/ | ||
2310 | static wlandevice_t *create_wlan(void) | ||
2311 | { | ||
2312 | wlandevice_t *wlandev = NULL; | ||
2313 | hfa384x_t *hw = NULL; | ||
2314 | |||
2315 | /* Alloc our structures */ | ||
2316 | wlandev = kmalloc(sizeof(wlandevice_t), GFP_KERNEL); | ||
2317 | hw = kmalloc(sizeof(hfa384x_t), GFP_KERNEL); | ||
2318 | |||
2319 | if (!wlandev || !hw) { | ||
2320 | WLAN_LOG_ERROR("%s: Memory allocation failure.\n", dev_info); | ||
2321 | if (wlandev) kfree(wlandev); | ||
2322 | if (hw) kfree(hw); | ||
2323 | return NULL; | ||
2324 | } | ||
2325 | |||
2326 | /* Clear all the structs */ | ||
2327 | memset(wlandev, 0, sizeof(wlandevice_t)); | ||
2328 | memset(hw, 0, sizeof(hfa384x_t)); | ||
2329 | |||
2330 | /* Initialize the network device object. */ | ||
2331 | wlandev->nsdname = dev_info; | ||
2332 | wlandev->msdstate = WLAN_MSD_HWPRESENT_PENDING; | ||
2333 | wlandev->priv = hw; | ||
2334 | wlandev->open = prism2sta_open; | ||
2335 | wlandev->close = prism2sta_close; | ||
2336 | wlandev->reset = prism2sta_reset; | ||
2337 | #ifdef CONFIG_PROC_FS | ||
2338 | wlandev->nsd_proc_read = prism2sta_proc_read; | ||
2339 | #endif | ||
2340 | wlandev->txframe = prism2sta_txframe; | ||
2341 | wlandev->mlmerequest = prism2sta_mlmerequest; | ||
2342 | wlandev->set_multicast_list = prism2sta_setmulticast; | ||
2343 | wlandev->tx_timeout = hfa384x_tx_timeout; | ||
2344 | |||
2345 | wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | | ||
2346 | P80211_NSDCAP_AUTOJOIN; | ||
2347 | |||
2348 | /* Initialize the device private data stucture. */ | ||
2349 | hw->dot11_desired_bss_type = 1; | ||
2350 | |||
2351 | return wlandev; | ||
2352 | } | ||
2353 | |||
2354 | #ifdef CONFIG_PROC_FS | ||
2355 | static int | ||
2356 | prism2sta_proc_read( | ||
2357 | char *page, | ||
2358 | char **start, | ||
2359 | off_t offset, | ||
2360 | int count, | ||
2361 | int *eof, | ||
2362 | void *data) | ||
2363 | { | ||
2364 | char *p = page; | ||
2365 | wlandevice_t *wlandev = (wlandevice_t *) data; | ||
2366 | hfa384x_t *hw = (hfa384x_t *) wlandev->priv; | ||
2367 | |||
2368 | UINT16 hwtype = 0; | ||
2369 | |||
2370 | DBFENTER; | ||
2371 | if (offset != 0) { | ||
2372 | *eof = 1; | ||
2373 | goto exit; | ||
2374 | } | ||
2375 | |||
2376 | // XXX 0x0001 for prism2.5/3, 0x0000 for prism2. | ||
2377 | hwtype = BIT0; | ||
2378 | |||
2379 | #if (WLAN_HOSTIF != WLAN_USB) | ||
2380 | if (hw->isram16) | ||
2381 | hwtype |= BIT1; | ||
2382 | #endif | ||
2383 | |||
2384 | #if (WLAN_HOSTIF == WLAN_PCI) | ||
2385 | hwtype |= BIT2; | ||
2386 | #endif | ||
2387 | |||
2388 | #define PRISM2_CVS_ID "$Id: prism2sta.c 1826 2007-03-19 15:37:00Z pizza $" | ||
2389 | |||
2390 | p += sprintf(p, "# %s version %s (%s) '%s'\n\n", | ||
2391 | dev_info, | ||
2392 | WLAN_RELEASE, WLAN_BUILD_DATE, PRISM2_CVS_ID); | ||
2393 | |||
2394 | p += sprintf(p, "# nic h/w: id=0x%02x %d.%d.%d\n", | ||
2395 | hw->ident_nic.id, hw->ident_nic.major, | ||
2396 | hw->ident_nic.minor, hw->ident_nic.variant); | ||
2397 | |||
2398 | p += sprintf(p, "# pri f/w: id=0x%02x %d.%d.%d\n", | ||
2399 | hw->ident_pri_fw.id, hw->ident_pri_fw.major, | ||
2400 | hw->ident_pri_fw.minor, hw->ident_pri_fw.variant); | ||
2401 | |||
2402 | if (hw->ident_sta_fw.id == 0x1f) { | ||
2403 | p += sprintf(p, "# sta f/w: id=0x%02x %d.%d.%d\n", | ||
2404 | hw->ident_sta_fw.id, hw->ident_sta_fw.major, | ||
2405 | hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); | ||
2406 | } else { | ||
2407 | p += sprintf(p, "# ap f/w: id=0x%02x %d.%d.%d\n", | ||
2408 | hw->ident_sta_fw.id, hw->ident_sta_fw.major, | ||
2409 | hw->ident_sta_fw.minor, hw->ident_sta_fw.variant); | ||
2410 | } | ||
2411 | |||
2412 | #if (WLAN_HOSTIF != WLAN_USB) | ||
2413 | p += sprintf(p, "# initial nic hw type, needed for SSF ramdl\n"); | ||
2414 | p += sprintf(p, "initnichw=%04x\n", hwtype); | ||
2415 | #endif | ||
2416 | |||
2417 | exit: | ||
2418 | DBFEXIT; | ||
2419 | return (p - page); | ||
2420 | } | ||
2421 | #endif | ||
2422 | |||
2423 | void prism2sta_commsqual_defer(struct work_struct *data) | ||
2424 | { | ||
2425 | hfa384x_t *hw = container_of(data, struct hfa384x, commsqual_bh); | ||
2426 | wlandevice_t *wlandev = hw->wlandev; | ||
2427 | hfa384x_bytestr32_t ssid; | ||
2428 | int result = 0; | ||
2429 | |||
2430 | DBFENTER; | ||
2431 | |||
2432 | if (hw->wlandev->hwremoved) | ||
2433 | goto done; | ||
2434 | |||
2435 | /* we don't care if we're in AP mode */ | ||
2436 | if ((wlandev->macmode == WLAN_MACMODE_NONE) || | ||
2437 | (wlandev->macmode == WLAN_MACMODE_ESS_AP)) { | ||
2438 | goto done; | ||
2439 | } | ||
2440 | |||
2441 | /* It only makes sense to poll these in non-IBSS */ | ||
2442 | if (wlandev->macmode != WLAN_MACMODE_IBSS_STA) { | ||
2443 | result = hfa384x_drvr_getconfig(hw, HFA384x_RID_DBMCOMMSQUALITY, | ||
2444 | &hw->qual, | ||
2445 | HFA384x_RID_DBMCOMMSQUALITY_LEN); | ||
2446 | |||
2447 | if (result) { | ||
2448 | WLAN_LOG_ERROR("error fetching commsqual\n"); | ||
2449 | goto done; | ||
2450 | } | ||
2451 | |||
2452 | // qual.CQ_currBSS; // link | ||
2453 | // ASL_currBSS; // level | ||
2454 | // qual.ANL_currFC; // noise | ||
2455 | |||
2456 | WLAN_LOG_DEBUG(3, "commsqual %d %d %d\n", | ||
2457 | hfa384x2host_16(hw->qual.CQ_currBSS), | ||
2458 | hfa384x2host_16(hw->qual.ASL_currBSS), | ||
2459 | hfa384x2host_16(hw->qual.ANL_currFC)); | ||
2460 | } | ||
2461 | |||
2462 | /* Lastly, we need to make sure the BSSID didn't change on us */ | ||
2463 | result = hfa384x_drvr_getconfig(hw, | ||
2464 | HFA384x_RID_CURRENTBSSID, | ||
2465 | wlandev->bssid, WLAN_BSSID_LEN); | ||
2466 | if ( result ) { | ||
2467 | WLAN_LOG_DEBUG(1, | ||
2468 | "getconfig(0x%02x) failed, result = %d\n", | ||
2469 | HFA384x_RID_CURRENTBSSID, result); | ||
2470 | goto done; | ||
2471 | } | ||
2472 | |||
2473 | result = hfa384x_drvr_getconfig(hw, | ||
2474 | HFA384x_RID_CURRENTSSID, | ||
2475 | &ssid, sizeof(ssid)); | ||
2476 | if ( result ) { | ||
2477 | WLAN_LOG_DEBUG(1, | ||
2478 | "getconfig(0x%02x) failed, result = %d\n", | ||
2479 | HFA384x_RID_CURRENTSSID, result); | ||
2480 | goto done; | ||
2481 | } | ||
2482 | prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid, | ||
2483 | (p80211pstrd_t *) &wlandev->ssid); | ||
2484 | |||
2485 | |||
2486 | /* Reschedule timer */ | ||
2487 | mod_timer(&hw->commsqual_timer, jiffies + HZ); | ||
2488 | |||
2489 | done: | ||
2490 | DBFEXIT; | ||
2491 | } | ||
2492 | |||
2493 | void prism2sta_commsqual_timer(unsigned long data) | ||
2494 | { | ||
2495 | hfa384x_t *hw = (hfa384x_t *) data; | ||
2496 | |||
2497 | DBFENTER; | ||
2498 | |||
2499 | schedule_work(&hw->commsqual_bh); | ||
2500 | |||
2501 | DBFEXIT; | ||
2502 | } | ||
diff --git a/drivers/staging/wlan-ng/version.h b/drivers/staging/wlan-ng/version.h new file mode 100644 index 000000000000..305f88239446 --- /dev/null +++ b/drivers/staging/wlan-ng/version.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* src/include/wlan/version.h | ||
2 | * | ||
3 | * | ||
4 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
5 | * -------------------------------------------------------------------- | ||
6 | * | ||
7 | * linux-wlan | ||
8 | * | ||
9 | * The contents of this file are subject to the Mozilla Public | ||
10 | * License Version 1.1 (the "License"); you may not use this file | ||
11 | * except in compliance with the License. You may obtain a copy of | ||
12 | * the License at http://www.mozilla.org/MPL/ | ||
13 | * | ||
14 | * Software distributed under the License is distributed on an "AS | ||
15 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
16 | * implied. See the License for the specific language governing | ||
17 | * rights and limitations under the License. | ||
18 | * | ||
19 | * Alternatively, the contents of this file may be used under the | ||
20 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
21 | * case the provisions of the GPL are applicable instead of the | ||
22 | * above. If you wish to allow the use of your version of this file | ||
23 | * only under the terms of the GPL and not to allow others to use | ||
24 | * your version of this file under the MPL, indicate your decision | ||
25 | * by deleting the provisions above and replace them with the notice | ||
26 | * and other provisions required by the GPL. If you do not delete | ||
27 | * the provisions above, a recipient may use your version of this | ||
28 | * file under either the MPL or the GPL. | ||
29 | * | ||
30 | * -------------------------------------------------------------------- | ||
31 | * | ||
32 | * Inquiries regarding the linux-wlan Open Source project can be | ||
33 | * made directly to: | ||
34 | * | ||
35 | * AbsoluteValue Systems Inc. | ||
36 | * info@linux-wlan.com | ||
37 | * http://www.linux-wlan.com | ||
38 | * | ||
39 | * -------------------------------------------------------------------- | ||
40 | * | ||
41 | * Portions of the development of this software were funded by | ||
42 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
43 | * | ||
44 | * -------------------------------------------------------------------- | ||
45 | */ | ||
46 | #ifndef _WLAN_VERSION_H | ||
47 | #define _WLAN_VERSION_H | ||
48 | #ifndef KERNEL_VERSION | ||
49 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
50 | #endif | ||
51 | |||
52 | /* WLAN_HOSTIF (generally set on the command line, not detected) */ | ||
53 | #define WLAN_NONE 0 | ||
54 | #define WLAN_PCMCIA 1 | ||
55 | #define WLAN_ISA 2 | ||
56 | #define WLAN_PCI 3 | ||
57 | #define WLAN_USB 4 | ||
58 | #define WLAN_PLX 5 | ||
59 | #define WLAN_SLAVE 6 | ||
60 | #define WLAN_RELEASE "0.2.8" | ||
61 | #define WLAN_RELEASE_CODE 0x000208 | ||
62 | #define WLAN_BUILD_DATE "Thu Oct 2 11:04:42 PDT 2008" | ||
63 | |||
64 | #endif | ||
diff --git a/drivers/staging/wlan-ng/wlan_compat.h b/drivers/staging/wlan-ng/wlan_compat.h new file mode 100644 index 000000000000..17026570708f --- /dev/null +++ b/drivers/staging/wlan-ng/wlan_compat.h | |||
@@ -0,0 +1,757 @@ | |||
1 | /* wlan_compat.h | ||
2 | * | ||
3 | * Types and macros to aid in portability | ||
4 | * | ||
5 | * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. | ||
6 | * -------------------------------------------------------------------- | ||
7 | * | ||
8 | * linux-wlan | ||
9 | * | ||
10 | * The contents of this file are subject to the Mozilla Public | ||
11 | * License Version 1.1 (the "License"); you may not use this file | ||
12 | * except in compliance with the License. You may obtain a copy of | ||
13 | * the License at http://www.mozilla.org/MPL/ | ||
14 | * | ||
15 | * Software distributed under the License is distributed on an "AS | ||
16 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | ||
17 | * implied. See the License for the specific language governing | ||
18 | * rights and limitations under the License. | ||
19 | * | ||
20 | * Alternatively, the contents of this file may be used under the | ||
21 | * terms of the GNU Public License version 2 (the "GPL"), in which | ||
22 | * case the provisions of the GPL are applicable instead of the | ||
23 | * above. If you wish to allow the use of your version of this file | ||
24 | * only under the terms of the GPL and not to allow others to use | ||
25 | * your version of this file under the MPL, indicate your decision | ||
26 | * by deleting the provisions above and replace them with the notice | ||
27 | * and other provisions required by the GPL. If you do not delete | ||
28 | * the provisions above, a recipient may use your version of this | ||
29 | * file under either the MPL or the GPL. | ||
30 | * | ||
31 | * -------------------------------------------------------------------- | ||
32 | * | ||
33 | * Inquiries regarding the linux-wlan Open Source project can be | ||
34 | * made directly to: | ||
35 | * | ||
36 | * AbsoluteValue Systems Inc. | ||
37 | * info@linux-wlan.com | ||
38 | * http://www.linux-wlan.com | ||
39 | * | ||
40 | * -------------------------------------------------------------------- | ||
41 | * | ||
42 | * Portions of the development of this software were funded by | ||
43 | * Intersil Corporation as part of PRISM(R) chipset product development. | ||
44 | * | ||
45 | * -------------------------------------------------------------------- | ||
46 | */ | ||
47 | |||
48 | #ifndef _WLAN_COMPAT_H | ||
49 | #define _WLAN_COMPAT_H | ||
50 | |||
51 | /*=============================================================*/ | ||
52 | /*------ Establish Platform Identity --------------------------*/ | ||
53 | /*=============================================================*/ | ||
54 | /* Key macros: */ | ||
55 | /* WLAN_CPU_FAMILY */ | ||
56 | #define WLAN_Ix86 1 | ||
57 | #define WLAN_PPC 2 | ||
58 | #define WLAN_Ix96 3 | ||
59 | #define WLAN_ARM 4 | ||
60 | #define WLAN_ALPHA 5 | ||
61 | #define WLAN_MIPS 6 | ||
62 | #define WLAN_HPPA 7 | ||
63 | #define WLAN_SPARC 8 | ||
64 | #define WLAN_SH 9 | ||
65 | #define WLAN_x86_64 10 | ||
66 | /* WLAN_SYSARCH */ | ||
67 | #define WLAN_PCAT 1 | ||
68 | #define WLAN_MBX 2 | ||
69 | #define WLAN_RPX 3 | ||
70 | #define WLAN_LWARCH 4 | ||
71 | #define WLAN_PMAC 5 | ||
72 | #define WLAN_SKIFF 6 | ||
73 | #define WLAN_BITSY 7 | ||
74 | #define WLAN_ALPHAARCH 7 | ||
75 | #define WLAN_MIPSARCH 9 | ||
76 | #define WLAN_HPPAARCH 10 | ||
77 | #define WLAN_SPARCARCH 11 | ||
78 | #define WLAN_SHARCH 12 | ||
79 | |||
80 | /* Note: the PLX HOSTIF above refers to some vendors implementations for */ | ||
81 | /* PCI. It's a PLX chip that is a PCI to PCMCIA adapter, but it */ | ||
82 | /* isn't a real PCMCIA host interface adapter providing all the */ | ||
83 | /* card&socket services. */ | ||
84 | |||
85 | #if (defined(CONFIG_PPC) || defined(CONFIG_8xx) || defined(__powerpc__)) | ||
86 | #ifndef __ppc__ | ||
87 | #define __ppc__ | ||
88 | #endif | ||
89 | #endif | ||
90 | |||
91 | #if defined(__KERNEL__) | ||
92 | |||
93 | #ifndef AUTOCONF_INCLUDED | ||
94 | #include <linux/config.h> | ||
95 | #endif | ||
96 | |||
97 | #if defined(__x86_64__) | ||
98 | #define WLAN_CPU_FAMILY WLAN_x86_64 | ||
99 | #define WLAN_SYSARCH WLAN_PCAT | ||
100 | #elif defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) | ||
101 | #define WLAN_CPU_FAMILY WLAN_Ix86 | ||
102 | #define WLAN_SYSARCH WLAN_PCAT | ||
103 | #elif defined(__ppc__) | ||
104 | #define WLAN_CPU_FAMILY WLAN_PPC | ||
105 | #if defined(CONFIG_MBX) | ||
106 | #define WLAN_SYSARCH WLAN_MBX | ||
107 | #elif defined(CONFIG_RPXLITE) | ||
108 | #define WLAN_SYSARCH WLAN_RPX | ||
109 | #elif defined(CONFIG_RPXCLASSIC) | ||
110 | #define WLAN_SYSARCH WLAN_RPX | ||
111 | #else | ||
112 | #define WLAN_SYSARCH WLAN_PMAC | ||
113 | #endif | ||
114 | #elif defined(__arm__) | ||
115 | #define WLAN_CPU_FAMILY WLAN_ARM | ||
116 | #define WLAN_SYSARCH WLAN_SKIFF | ||
117 | #elif defined(__alpha__) | ||
118 | #define WLAN_CPU_FAMILY WLAN_ALPHA | ||
119 | #define WLAN_SYSARCH WLAN_ALPHAARCH | ||
120 | #elif defined(__mips__) | ||
121 | #define WLAN_CPU_FAMILY WLAN_MIPS | ||
122 | #define WLAN_SYSARCH WLAN_MIPSARCH | ||
123 | #elif defined(__hppa__) | ||
124 | #define WLAN_CPU_FAMILY WLAN_HPPA | ||
125 | #define WLAN_SYSARCH WLAN_HPPAARCH | ||
126 | #elif defined(__sparc__) | ||
127 | #define WLAN_CPU_FAMILY WLAN_SPARC | ||
128 | #define WLAN_SYSARCH WLAN_SPARC | ||
129 | #elif defined(__sh__) | ||
130 | #define WLAN_CPU_FAMILY WLAN_SH | ||
131 | #define WLAN_SYSARCH WLAN_SHARCH | ||
132 | #ifndef __LITTLE_ENDIAN__ | ||
133 | #define __LITTLE_ENDIAN__ | ||
134 | #endif | ||
135 | #else | ||
136 | #error "No CPU identified!" | ||
137 | #endif | ||
138 | #endif /* __KERNEL__ */ | ||
139 | |||
140 | /* | ||
141 | Some big endian machines implicitly do all I/O in little endian mode. | ||
142 | |||
143 | In particular: | ||
144 | Linux/PPC on PowerMacs (PCI) | ||
145 | Arm/Intel Xscale (PCI) | ||
146 | |||
147 | This may also affect PLX boards and other BE &| PPC platforms; | ||
148 | as new ones are discovered, add them below. | ||
149 | */ | ||
150 | |||
151 | #if defined(WLAN_HOSTIF) | ||
152 | #if ((WLAN_HOSTIF == WLAN_PCI) || (WLAN_HOSTIF == WLAN_PLX)) | ||
153 | #if ((WLAN_SYSARCH == WLAN_SKIFF) || (WLAN_SYSARCH == WLAN_PMAC) || (WLAN_SYSARCH == WLAN_SPARC)) | ||
154 | #define REVERSE_ENDIAN | ||
155 | #endif | ||
156 | #endif | ||
157 | #endif | ||
158 | |||
159 | /*=============================================================*/ | ||
160 | /*------ Bit settings -----------------------------------------*/ | ||
161 | /*=============================================================*/ | ||
162 | |||
163 | #define BIT0 0x00000001 | ||
164 | #define BIT1 0x00000002 | ||
165 | #define BIT2 0x00000004 | ||
166 | #define BIT3 0x00000008 | ||
167 | #define BIT4 0x00000010 | ||
168 | #define BIT5 0x00000020 | ||
169 | #define BIT6 0x00000040 | ||
170 | #define BIT7 0x00000080 | ||
171 | #define BIT8 0x00000100 | ||
172 | #define BIT9 0x00000200 | ||
173 | #define BIT10 0x00000400 | ||
174 | #define BIT11 0x00000800 | ||
175 | #define BIT12 0x00001000 | ||
176 | #define BIT13 0x00002000 | ||
177 | #define BIT14 0x00004000 | ||
178 | #define BIT15 0x00008000 | ||
179 | #define BIT16 0x00010000 | ||
180 | #define BIT17 0x00020000 | ||
181 | #define BIT18 0x00040000 | ||
182 | #define BIT19 0x00080000 | ||
183 | #define BIT20 0x00100000 | ||
184 | #define BIT21 0x00200000 | ||
185 | #define BIT22 0x00400000 | ||
186 | #define BIT23 0x00800000 | ||
187 | #define BIT24 0x01000000 | ||
188 | #define BIT25 0x02000000 | ||
189 | #define BIT26 0x04000000 | ||
190 | #define BIT27 0x08000000 | ||
191 | #define BIT28 0x10000000 | ||
192 | #define BIT29 0x20000000 | ||
193 | #define BIT30 0x40000000 | ||
194 | #define BIT31 0x80000000 | ||
195 | |||
196 | #include <linux/types.h> | ||
197 | |||
198 | typedef u_int8_t UINT8; | ||
199 | typedef u_int16_t UINT16; | ||
200 | typedef u_int32_t UINT32; | ||
201 | |||
202 | typedef int8_t INT8; | ||
203 | typedef int16_t INT16; | ||
204 | typedef int32_t INT32; | ||
205 | |||
206 | typedef unsigned int UINT; | ||
207 | typedef signed int INT; | ||
208 | |||
209 | typedef u_int64_t UINT64; | ||
210 | typedef int64_t INT64; | ||
211 | |||
212 | #define UINT8_MAX (0xffUL) | ||
213 | #define UINT16_MAX (0xffffUL) | ||
214 | #define UINT32_MAX (0xffffffffUL) | ||
215 | |||
216 | #define INT8_MAX (0x7fL) | ||
217 | #define INT16_MAX (0x7fffL) | ||
218 | #define INT32_MAX (0x7fffffffL) | ||
219 | |||
220 | /*=============================================================*/ | ||
221 | /*------ Compiler Portability Macros --------------------------*/ | ||
222 | /*=============================================================*/ | ||
223 | #define __WLAN_ATTRIB_PACK__ __attribute__ ((packed)) | ||
224 | |||
225 | /*=============================================================*/ | ||
226 | /*------ OS Portability Macros --------------------------------*/ | ||
227 | /*=============================================================*/ | ||
228 | |||
229 | #ifndef WLAN_DBVAR | ||
230 | #define WLAN_DBVAR wlan_debug | ||
231 | #endif | ||
232 | |||
233 | #ifndef KERNEL_VERSION | ||
234 | #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) | ||
235 | #endif | ||
236 | |||
237 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) | ||
238 | # if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)) | ||
239 | # include <linux/hardirq.h> | ||
240 | # else | ||
241 | # include <asm/hardirq.h> | ||
242 | # endif | ||
243 | #elif defined(__KERNEL__) | ||
244 | # define PREEMPT_MASK (0x000000FFUL) | ||
245 | # define preempt_count() (0UL) | ||
246 | #endif | ||
247 | |||
248 | #define WLAN_LOG_ERROR(x,args...) printk(KERN_ERR "%s: " x , __FUNCTION__ , ##args); | ||
249 | |||
250 | #define WLAN_LOG_WARNING(x,args...) printk(KERN_WARNING "%s: " x , __FUNCTION__ , ##args); | ||
251 | |||
252 | #define WLAN_LOG_NOTICE(x,args...) printk(KERN_NOTICE "%s: " x , __FUNCTION__ , ##args); | ||
253 | |||
254 | #define WLAN_LOG_INFO(args... ) printk(KERN_INFO args) | ||
255 | |||
256 | #if defined(WLAN_INCLUDE_DEBUG) | ||
257 | #define WLAN_ASSERT(c) if ((!(c)) && WLAN_DBVAR >= 1) { \ | ||
258 | WLAN_LOG_DEBUG(1, "Assertion failure!\n"); } | ||
259 | #define WLAN_HEX_DUMP( l, x, p, n) if( WLAN_DBVAR >= (l) ){ \ | ||
260 | int __i__; \ | ||
261 | printk(KERN_DEBUG x ":"); \ | ||
262 | for( __i__=0; __i__ < (n); __i__++) \ | ||
263 | printk( " %02x", ((UINT8*)(p))[__i__]); \ | ||
264 | printk("\n"); } | ||
265 | #define DBFENTER { if ( WLAN_DBVAR >= 5 ){ WLAN_LOG_DEBUG(3,"---->\n"); } } | ||
266 | #define DBFEXIT { if ( WLAN_DBVAR >= 5 ){ WLAN_LOG_DEBUG(3,"<----\n"); } } | ||
267 | |||
268 | #define WLAN_LOG_DEBUG(l,x,args...) if ( WLAN_DBVAR >= (l)) printk(KERN_DEBUG "%s(%lu): " x , __FUNCTION__, (preempt_count() & PREEMPT_MASK), ##args ); | ||
269 | #else | ||
270 | #define WLAN_ASSERT(c) | ||
271 | #define WLAN_HEX_DUMP( l, s, p, n) | ||
272 | #define DBFENTER | ||
273 | #define DBFEXIT | ||
274 | |||
275 | #define WLAN_LOG_DEBUG(l, s, args...) | ||
276 | #endif | ||
277 | |||
278 | #ifdef CONFIG_SMP | ||
279 | #define __SMP__ 1 | ||
280 | #endif | ||
281 | |||
282 | #if defined(__KERNEL__) | ||
283 | |||
284 | #if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))) | ||
285 | #define URB_ONLY_CALLBACK | ||
286 | #endif | ||
287 | |||
288 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) | ||
289 | #define PT_REGS , struct pt_regs *regs | ||
290 | #else | ||
291 | #define PT_REGS | ||
292 | #endif | ||
293 | |||
294 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) | ||
295 | # define del_singleshot_timer_sync(a) del_timer_sync(a) | ||
296 | #endif | ||
297 | |||
298 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,17)) | ||
299 | #define CONFIG_NETLINK 1 | ||
300 | #endif | ||
301 | |||
302 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)) | ||
303 | #define kfree_s(a, b) kfree((a)) | ||
304 | #endif | ||
305 | |||
306 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18)) | ||
307 | #ifndef init_waitqueue_head | ||
308 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,0,16)) | ||
309 | #define init_waitqueue_head(p) (*(p) = NULL) | ||
310 | #else | ||
311 | #define init_waitqueue_head(p) init_waitqueue(p) | ||
312 | #endif | ||
313 | typedef struct wait_queue *wait_queue_head_t; | ||
314 | typedef struct wait_queue wait_queue_t; | ||
315 | #define set_current_state(b) { current->state = (b); mb(); } | ||
316 | #define init_waitqueue_entry(a, b) { (a)->task = current; } | ||
317 | #endif | ||
318 | #endif | ||
319 | |||
320 | #ifndef wait_event_interruptible_timeout | ||
321 | // retval == 0; signal met; we're good. | ||
322 | // retval < 0; interrupted by signal. | ||
323 | // retval > 0; timed out. | ||
324 | |||
325 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)) // fixme? | ||
326 | |||
327 | #define __wait_event_interruptible_timeout(wq, condition, ret) \ | ||
328 | do { \ | ||
329 | wait_queue_t __wait; \ | ||
330 | init_waitqueue_entry(&__wait, current); \ | ||
331 | \ | ||
332 | add_wait_queue(&wq, &__wait); \ | ||
333 | for (;;) { \ | ||
334 | set_current_state(TASK_INTERRUPTIBLE); \ | ||
335 | if (condition) \ | ||
336 | break; \ | ||
337 | if (!signal_pending(current)) { \ | ||
338 | ret = schedule_timeout(ret) ; \ | ||
339 | if (!ret) \ | ||
340 | break; \ | ||
341 | continue; \ | ||
342 | } \ | ||
343 | ret = -ERESTARTSYS; \ | ||
344 | break; \ | ||
345 | } \ | ||
346 | set_current_state(TASK_RUNNING); \ | ||
347 | remove_wait_queue(&wq, &__wait); \ | ||
348 | } while (0) | ||
349 | |||
350 | #else // 2.2 | ||
351 | |||
352 | |||
353 | #define __wait_event_interruptible_timeout(wq, condition, ret) \ | ||
354 | do { \ | ||
355 | struct wait_queue __wait; \ | ||
356 | \ | ||
357 | __wait.task = current; \ | ||
358 | add_wait_queue(&wq, &__wait); \ | ||
359 | for (;;) { \ | ||
360 | current->state = TASK_INTERRUPTIBLE; \ | ||
361 | if (condition) \ | ||
362 | break; \ | ||
363 | if (!signal_pending(current)) { \ | ||
364 | ret = schedule_timeout(ret); \ | ||
365 | if (!ret) \ | ||
366 | break; \ | ||
367 | continue; \ | ||
368 | } \ | ||
369 | ret = -ERESTARTSYS; \ | ||
370 | break; \ | ||
371 | } \ | ||
372 | current->state = TASK_RUNNING; \ | ||
373 | remove_wait_queue(&wq, &__wait); \ | ||
374 | } while (0) | ||
375 | |||
376 | #endif // version >= 2.4 | ||
377 | |||
378 | #define wait_event_interruptible_timeout(wq, condition, timeout) \ | ||
379 | ({ \ | ||
380 | long __ret = timeout; \ | ||
381 | if (!(condition)) \ | ||
382 | __wait_event_interruptible_timeout(wq, condition, __ret); \ | ||
383 | __ret; \ | ||
384 | }) | ||
385 | |||
386 | #endif | ||
387 | |||
388 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20)) | ||
389 | #ifdef _LINUX_LIST_H | ||
390 | |||
391 | static inline void list_move_tail(struct list_head *list, | ||
392 | struct list_head *head) | ||
393 | { | ||
394 | __list_del(list->prev, list->next); | ||
395 | list_add_tail(list, head); | ||
396 | } | ||
397 | |||
398 | static inline void __list_splice(struct list_head *list, | ||
399 | struct list_head *head) | ||
400 | { | ||
401 | struct list_head *first = list->next; | ||
402 | struct list_head *last = list->prev; | ||
403 | struct list_head *at = head->next; | ||
404 | |||
405 | first->prev = head; | ||
406 | head->next = first; | ||
407 | |||
408 | last->next = at; | ||
409 | at->prev = last; | ||
410 | } | ||
411 | |||
412 | static inline void list_move(struct list_head *list, struct list_head *head) | ||
413 | { | ||
414 | __list_del(list->prev, list->next); | ||
415 | list_add(list, head); | ||
416 | } | ||
417 | |||
418 | static inline void list_splice_init(struct list_head *list, | ||
419 | struct list_head *head) | ||
420 | { | ||
421 | if (!list_empty(list)) { | ||
422 | __list_splice(list, head); | ||
423 | INIT_LIST_HEAD(list); | ||
424 | } | ||
425 | } | ||
426 | |||
427 | |||
428 | #endif // LIST_H | ||
429 | #endif | ||
430 | |||
431 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,90)) | ||
432 | #define spin_lock(l) do { } while (0) | ||
433 | #define spin_unlock(l) do { } while (0) | ||
434 | #define spin_lock_irqsave(l,f) do { save_flags(f); cli(); } while (0) | ||
435 | #define spin_unlock_irqrestore(l,f) do { restore_flags(f); } while (0) | ||
436 | #define spin_lock_init(s) do { } while (0) | ||
437 | #define spin_trylock(l) (1) | ||
438 | typedef int spinlock_t; | ||
439 | #endif | ||
440 | |||
441 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) // XXX ??? | ||
442 | #define spin_lock_bh spin_lock | ||
443 | #endif | ||
444 | |||
445 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) | ||
446 | #ifdef CONFIG_SMP | ||
447 | #define spin_is_locked(x) (*(volatile char *)(&(x)->lock) <= 0) | ||
448 | #else | ||
449 | #define spin_is_locked(l) (0) | ||
450 | #endif | ||
451 | #endif | ||
452 | |||
453 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,28)) | ||
454 | #define __user | ||
455 | #define __iomem | ||
456 | #endif | ||
457 | |||
458 | #ifdef _LINUX_PROC_FS_H | ||
459 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,25)) | ||
460 | |||
461 | extern inline struct proc_dir_entry * | ||
462 | create_proc_read_entry(const char *name, mode_t mode, | ||
463 | struct proc_dir_entry *base, | ||
464 | read_proc_t *read_proc, void *data) | ||
465 | { | ||
466 | struct proc_dir_entry *res = create_proc_entry(name, mode, base); | ||
467 | if (res) { | ||
468 | res->read_proc = read_proc; | ||
469 | res->data = data; | ||
470 | } | ||
471 | return res; | ||
472 | } | ||
473 | #endif | ||
474 | |||
475 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,29)) | ||
476 | #ifndef proc_mkdir | ||
477 | #define proc_mkdir(name, root) create_proc_entry(name, S_IFDIR, root) | ||
478 | #endif | ||
479 | #endif | ||
480 | #endif /* _LINUX_PROC_FS_H */ | ||
481 | |||
482 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
483 | #ifndef INIT_TQUEUE | ||
484 | #define PREPARE_TQUEUE(_tq, _routine, _data) \ | ||
485 | do { \ | ||
486 | (_tq)->routine = _routine; \ | ||
487 | (_tq)->data = _data; \ | ||
488 | } while (0) | ||
489 | #define INIT_TQUEUE(_tq, _routine, _data) \ | ||
490 | do { \ | ||
491 | INIT_LIST_HEAD(&(_tq)->list); \ | ||
492 | (_tq)->sync = 0; \ | ||
493 | PREPARE_TQUEUE((_tq), (_routine), (_data)); \ | ||
494 | } while (0) | ||
495 | #endif | ||
496 | |||
497 | #ifndef container_of | ||
498 | #define container_of(ptr, type, member) ({ \ | ||
499 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | ||
500 | (type *)( (char *)__mptr - offsetof(type,member) );}) | ||
501 | #endif | ||
502 | |||
503 | #ifndef INIT_WORK | ||
504 | #define work_struct tq_struct | ||
505 | |||
506 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) | ||
507 | #define schedule_work(a) queue_task(a, &tq_scheduler) | ||
508 | #else | ||
509 | #define schedule_work(a) schedule_task(a) | ||
510 | #endif | ||
511 | |||
512 | #define flush_scheduled_work flush_scheduled_tasks | ||
513 | #define INIT_WORK2(_wq, _routine) INIT_TQUEUE(_wq, (void (*)(void *))_routine, _wq) | ||
514 | #endif | ||
515 | |||
516 | #else // >= 2.5 kernel | ||
517 | |||
518 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) | ||
519 | #define INIT_WORK2(_wq, _routine) INIT_WORK(_wq, (void (*)(void *))_routine, _wq) | ||
520 | #else | ||
521 | #define INIT_WORK2(_wq, _routine) INIT_WORK(_wq, _routine) | ||
522 | #endif | ||
523 | |||
524 | #endif // >= 2.5 kernel | ||
525 | |||
526 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38)) | ||
527 | typedef struct device netdevice_t; | ||
528 | #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,4)) | ||
529 | typedef struct net_device netdevice_t; | ||
530 | #else | ||
531 | #undef netdevice_t | ||
532 | typedef struct net_device netdevice_t; | ||
533 | #endif | ||
534 | |||
535 | #ifdef WIRELESS_EXT | ||
536 | #if (WIRELESS_EXT < 13) | ||
537 | struct iw_request_info | ||
538 | { | ||
539 | __u16 cmd; /* Wireless Extension command */ | ||
540 | __u16 flags; /* More to come ;-) */ | ||
541 | }; | ||
542 | #endif | ||
543 | #endif | ||
544 | |||
545 | |||
546 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,18)) | ||
547 | #define MODULE_PARM(a,b) extern int __bogus_decl | ||
548 | #define MODULE_AUTHOR(a) extern int __bogus_decl | ||
549 | #define MODULE_DESCRIPTION(a) extern int __bogus_decl | ||
550 | #define MODULE_SUPPORTED_DEVICE(a) extern int __bogus_decl | ||
551 | #undef GET_USE_COUNT | ||
552 | #define GET_USE_COUNT(m) mod_use_count_ | ||
553 | #endif | ||
554 | |||
555 | #ifndef MODULE_OWNER | ||
556 | #define MODULE_OWNER(a) extern int __bogus_decl | ||
557 | #define ANCIENT_MODULE_CODE | ||
558 | #endif | ||
559 | |||
560 | #ifndef MODULE_LICENSE | ||
561 | #define MODULE_LICENSE(m) extern int __bogus_decl | ||
562 | #endif | ||
563 | |||
564 | /* TODO: Do we care about this? */ | ||
565 | #ifndef MODULE_DEVICE_TABLE | ||
566 | #define MODULE_DEVICE_TABLE(foo,bar) | ||
567 | #endif | ||
568 | |||
569 | #define wlan_minutes2ticks(a) ((a)*(wlan_ticks_per_sec * 60)) | ||
570 | #define wlan_seconds2ticks(a) ((a)*(wlan_ticks_per_sec)) | ||
571 | |||
572 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,47)) | ||
573 | #define NEW_MODULE_CODE | ||
574 | #ifdef ANCIENT_MODULE_CODE | ||
575 | #undef ANCIENT_MODULE_CODE | ||
576 | #endif | ||
577 | #elif (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25)) | ||
578 | #define module_param(name, type, perm) \ | ||
579 | static inline void *__check_existence_##name(void) { return &name; } \ | ||
580 | MODULE_PARM(name, _MODULE_PARM_STRING_ ## type) | ||
581 | |||
582 | #define _MODULE_PARM_STRING_byte "b" | ||
583 | #define _MODULE_PARM_STRING_short "h" | ||
584 | #define _MODULE_PARM_STRING_ushort "h" | ||
585 | #define _MODULE_PARM_STRING_int "i" | ||
586 | #define _MODULE_PARM_STRING_uint "i" | ||
587 | #define _MODULE_PARM_STRING_long "l" | ||
588 | #define _MODULE_PARM_STRING_ulong "l" | ||
589 | #define _MODULE_PARM_STRING_bool "i" | ||
590 | #endif | ||
591 | |||
592 | /* linux < 2.5.69 */ | ||
593 | #ifndef IRQ_NONE | ||
594 | typedef void irqreturn_t; | ||
595 | #define IRQ_NONE | ||
596 | #define IRQ_HANDLED | ||
597 | #define IRQ_RETVAL(x) | ||
598 | #endif | ||
599 | |||
600 | #ifndef in_atomic | ||
601 | #define in_atomic() 0 | ||
602 | #endif | ||
603 | |||
604 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) | ||
605 | #define URB_ASYNC_UNLINK 0 | ||
606 | #endif | ||
607 | |||
608 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)) | ||
609 | #define URB_ASYNC_UNLINK USB_ASYNC_UNLINK | ||
610 | #define usb_fill_bulk_urb FILL_BULK_URB | ||
611 | #define usb_kill_urb usb_unlink_urb | ||
612 | #else | ||
613 | #define USB_QUEUE_BULK 0 | ||
614 | #endif | ||
615 | |||
616 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)) | ||
617 | typedef u32 pm_message_t; | ||
618 | #endif | ||
619 | |||
620 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)) | ||
621 | #define hotplug_path "/etc/hotplug/wlan.agent" | ||
622 | #endif | ||
623 | |||
624 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) | ||
625 | #define free_netdev(x) kfree(x) | ||
626 | #endif | ||
627 | |||
628 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)) | ||
629 | #define eth_hdr(x) (x)->mac.ethernet | ||
630 | #endif | ||
631 | |||
632 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) | ||
633 | #define del_timer_sync(a) del_timer(a) | ||
634 | #endif | ||
635 | |||
636 | #ifndef might_sleep | ||
637 | #define might_sleep(a) do { } while (0) | ||
638 | #endif | ||
639 | |||
640 | /* Apparently 2.4.2 ethtool is quite different, maybe newer too? */ | ||
641 | #if (defined(SIOETHTOOL) && !defined(ETHTOOL_GDRVINFO)) | ||
642 | #undef SIOETHTOOL | ||
643 | #endif | ||
644 | |||
645 | // pcmcia-cs stuff | ||
646 | #if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,5,68)) && \ | ||
647 | !defined(pcmcia_access_configuration_register)) | ||
648 | #define pcmcia_access_configuration_register(handle, reg) \ | ||
649 | CardServices(AccessConfigurationRegister, handle, reg) | ||
650 | #define pcmcia_register_client(handle, reg) \ | ||
651 | CardServices(RegisterClient, handle, reg) | ||
652 | #define pcmcia_deregister_client(handle) \ | ||
653 | CardServices(DeregisterClient, handle) | ||
654 | #define pcmcia_get_first_tuple(handle, tuple) \ | ||
655 | CardServices(GetFirstTuple, handle, tuple) | ||
656 | #define pcmcia_get_next_tuple(handle, tuple) \ | ||
657 | CardServices(GetNextTuple, handle, tuple) | ||
658 | #define pcmcia_get_tuple_data(handle, tuple) \ | ||
659 | CardServices(GetTupleData, handle, tuple) | ||
660 | #define pcmcia_parse_tuple(handle, tuple, parse) \ | ||
661 | CardServices(ParseTuple, handle, tuple, parse) | ||
662 | #define pcmcia_get_configuration_info(handle, config) \ | ||
663 | CardServices(GetConfigurationInfo, handle, config) | ||
664 | #define pcmcia_request_io(handle, req) \ | ||
665 | CardServices(RequestIO, handle, req) | ||
666 | #define pcmcia_request_irq(handle, req) \ | ||
667 | CardServices(RequestIRQ, handle, req) | ||
668 | #define pcmcia_request_configuration(handle, req) \ | ||
669 | CardServices(RequestConfiguration, handle, req) | ||
670 | #define pcmcia_release_configuration(handle) \ | ||
671 | CardServices(ReleaseConfiguration, handle) | ||
672 | #define pcmcia_release_io(handle, req) \ | ||
673 | CardServices(ReleaseIO, handle, req) | ||
674 | #define pcmcia_release_irq(handle, req) \ | ||
675 | CardServices(ReleaseIRQ, handle, req) | ||
676 | #define pcmcia_release_window(win) \ | ||
677 | CardServices(ReleaseWindow, win) | ||
678 | #define pcmcia_get_card_services_info(info) \ | ||
679 | CardServices(GetCardServicesInfo, info) | ||
680 | #define pcmcia_report_error(handle, err) \ | ||
681 | CardServices(ReportError, handle, err) | ||
682 | #endif | ||
683 | |||
684 | #endif /* __KERNEL__ */ | ||
685 | |||
686 | /*=============================================================*/ | ||
687 | /*------ Hardware Portability Macros --------------------------*/ | ||
688 | /*=============================================================*/ | ||
689 | |||
690 | #define ieee2host16(n) __le16_to_cpu(n) | ||
691 | #define ieee2host32(n) __le32_to_cpu(n) | ||
692 | #define host2ieee16(n) __cpu_to_le16(n) | ||
693 | #define host2ieee32(n) __cpu_to_le32(n) | ||
694 | |||
695 | #if (WLAN_CPU_FAMILY != WLAN_MIPS) | ||
696 | typedef UINT32 phys_t; | ||
697 | #endif | ||
698 | |||
699 | #if (WLAN_CPU_FAMILY == WLAN_PPC) | ||
700 | #define wlan_inw(a) in_be16((unsigned short *)((a)+_IO_BASE)) | ||
701 | #define wlan_inw_le16_to_cpu(a) inw((a)) | ||
702 | #define wlan_outw(v,a) out_be16((unsigned short *)((a)+_IO_BASE), (v)) | ||
703 | #define wlan_outw_cpu_to_le16(v,a) outw((v),(a)) | ||
704 | #else | ||
705 | #define wlan_inw(a) inw((a)) | ||
706 | #define wlan_inw_le16_to_cpu(a) __cpu_to_le16(inw((a))) | ||
707 | #define wlan_outw(v,a) outw((v),(a)) | ||
708 | #define wlan_outw_cpu_to_le16(v,a) outw(__cpu_to_le16((v)),(a)) | ||
709 | #endif | ||
710 | |||
711 | /*=============================================================*/ | ||
712 | /*--- General Macros ------------------------------------------*/ | ||
713 | /*=============================================================*/ | ||
714 | |||
715 | #define wlan_max(a, b) (((a) > (b)) ? (a) : (b)) | ||
716 | #define wlan_min(a, b) (((a) < (b)) ? (a) : (b)) | ||
717 | |||
718 | #define wlan_isprint(c) (((c) > (0x19)) && ((c) < (0x7f))) | ||
719 | |||
720 | #define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a))) | ||
721 | |||
722 | /* Create a string of printable chars from something that might not be */ | ||
723 | /* It's recommended that the str be 4*len + 1 bytes long */ | ||
724 | #define wlan_mkprintstr(buf, buflen, str, strlen) \ | ||
725 | { \ | ||
726 | int i = 0; \ | ||
727 | int j = 0; \ | ||
728 | memset(str, 0, (strlen)); \ | ||
729 | for (i = 0; i < (buflen); i++) { \ | ||
730 | if ( wlan_isprint((buf)[i]) ) { \ | ||
731 | (str)[j] = (buf)[i]; \ | ||
732 | j++; \ | ||
733 | } else { \ | ||
734 | (str)[j] = '\\'; \ | ||
735 | (str)[j+1] = 'x'; \ | ||
736 | (str)[j+2] = wlan_hexchar(((buf)[i] & 0xf0) >> 4); \ | ||
737 | (str)[j+3] = wlan_hexchar(((buf)[i] & 0x0f)); \ | ||
738 | j += 4; \ | ||
739 | } \ | ||
740 | } \ | ||
741 | } | ||
742 | |||
743 | /*=============================================================*/ | ||
744 | /*--- Variables -----------------------------------------------*/ | ||
745 | /*=============================================================*/ | ||
746 | |||
747 | #ifdef WLAN_INCLUDE_DEBUG | ||
748 | extern int wlan_debug; | ||
749 | #endif | ||
750 | |||
751 | extern int wlan_ethconv; /* What's the default ethconv? */ | ||
752 | |||
753 | /*=============================================================*/ | ||
754 | /*--- Functions -----------------------------------------------*/ | ||
755 | /*=============================================================*/ | ||
756 | #endif /* _WLAN_COMPAT_H */ | ||
757 | |||